Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,21 @@ def run(self):
logger.debug("Cancelling job %s", self)
return CancelJob
return ret

def change_func(self, job_func, *args, **kwargs):
"""
Change the job's function that's called every time the
job runs.

Any additional arguments are passed on to job_func when
the job runs.

:param job_func: The function to replace the old one
:return: The invoked job instance
"""
self.job_func = functools.partial(job_func, *args, **kwargs)
functools.update_wrapper(self.job_func, job_func)
return self

def _schedule_next_run(self) -> None:
"""
Expand Down