Skip to content

Commit

Permalink
Merge 9fe6da4 into 6f28821
Browse files Browse the repository at this point in the history
  • Loading branch information
Skenvy committed Jan 21, 2021
2 parents 6f28821 + 9fe6da4 commit c40ffc0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions schedule/__init__.py
Expand Up @@ -109,6 +109,19 @@ def run_all(self, delay_seconds=0):
self._run_job(job)
time.sleep(delay_seconds)

def get_jobs(self, tag=None):
"""
Gets scheduled jobs marked with the given tag, or all jobs
if tag is omitted.
:param tag: An identifier used to identify a subset of
jobs to retrieve
"""
if tag is None:
return self.jobs
else:
return [job for job in self.jobs if tag in job.tags]

def clear(self, tag=None):
"""
Deletes scheduled jobs marked with the given tag, or all jobs
Expand Down Expand Up @@ -599,6 +612,13 @@ def run_all(delay_seconds=0):
default_scheduler.run_all(delay_seconds=delay_seconds)


def get_jobs(tag=None):
"""Calls :meth:`get_jobs <Scheduler.get_jobs>` on the
:data:`default scheduler instance <default_scheduler>`.
"""
default_scheduler.get_jobs(tag)


def clear(tag=None):
"""Calls :meth:`clear <Scheduler.clear>` on the
:data:`default scheduler instance <default_scheduler>`.
Expand Down

0 comments on commit c40ffc0

Please sign in to comment.