diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-08-09 00:01:46 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-08-09 00:02:05 +0300 |
commit | 93b219bf31a2638722c21f4ce44fe7c1d735ca45 (patch) | |
tree | 9c402c1399e767e38d4f6fb23554cecd1ec35154 /src/apscheduler | |
parent | ea0ed61cf3bfd24a2e0b9441e090a7be975dea98 (diff) | |
download | apscheduler-93b219bf31a2638722c21f4ce44fe7c1d735ca45.tar.gz |
Added get_schedules() methods to the scheduler classes
Diffstat (limited to 'src/apscheduler')
-rw-r--r-- | src/apscheduler/schedulers/async_.py | 9 | ||||
-rw-r--r-- | src/apscheduler/schedulers/sync.py | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/apscheduler/schedulers/async_.py b/src/apscheduler/schedulers/async_.py index bc99567..6c60bdd 100644 --- a/src/apscheduler/schedulers/async_.py +++ b/src/apscheduler/schedulers/async_.py @@ -177,6 +177,15 @@ class AsyncScheduler: else: raise ScheduleLookupError(id) + async def get_schedules(self) -> list[Schedule]: + """ + Retrieve all schedules from the data store. + + :return: a list of schedules, in an unspecified order + + """ + return await self.data_store.get_schedules() + async def remove_schedule(self, id: str) -> None: """ Remove the given schedule from the data store. diff --git a/src/apscheduler/schedulers/sync.py b/src/apscheduler/schedulers/sync.py index e64d43c..aea7047 100644 --- a/src/apscheduler/schedulers/sync.py +++ b/src/apscheduler/schedulers/sync.py @@ -207,6 +207,16 @@ class Scheduler: else: raise ScheduleLookupError(id) + def get_schedules(self) -> list[Schedule]: + """ + Retrieve all schedules from the data store. + + :return: a list of schedules, in an unspecified order + + """ + self._ensure_services_ready() + return self.data_store.get_schedules() + def remove_schedule(self, id: str) -> None: """ Remove the given schedule from the data store. |