dp3.common.scheduler ¶
Allows modules to register functions (callables) to be run at specified times or intervals (like cron does).
Based on APScheduler package
Scheduler ¶
Allows modules to register functions (callables) to be run at specified times or intervals (like cron does).
Source code in dp3/common/scheduler.py
register ¶
register(func: Callable, func_args: Union[list, tuple] = None, func_kwargs: dict = None, year: Union[int, str] = None, month: Union[int, str] = None, day: Union[int, str] = None, week: Union[int, str] = None, day_of_week: Union[int, str] = None, hour: Union[int, str] = None, minute: Union[int, str] = None, second: Union[int, str] = None, timezone: str = 'UTC', misfire_grace_time: int = 1) -> int
Register a function to be run at specified times.
Pass cron-like specification of when the function should be called, see docs of apscheduler.triggers.cron for details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
Callable
|
function or method to be called |
required |
func_args
|
Union[list, tuple]
|
list of positional arguments to call func with |
None
|
func_kwargs
|
dict
|
dict of keyword arguments to call func with |
None
|
year
|
Union[int, str]
|
4-digit year |
None
|
month
|
Union[int, str]
|
month (1-12) |
None
|
day
|
Union[int, str]
|
day of month (1-31) |
None
|
week
|
Union[int, str]
|
ISO week (1-53) |
None
|
day_of_week
|
Union[int, str]
|
number or name of weekday (0-6 or mon,tue,wed,thu,fri,sat,sun) |
None
|
hour
|
Union[int, str]
|
hour (0-23) |
None
|
minute
|
Union[int, str]
|
minute (0-59) |
None
|
second
|
Union[int, str]
|
second (0-59) |
None
|
timezone
|
str
|
Timezone for time specification (default is UTC). |
'UTC'
|
misfire_grace_time
|
int
|
seconds after the designated run time that the job is still allowed to be run (default is 1) |
1
|
Returns: job ID