ScheduledMethod class
Bases: Job
A periodic scheduled method used by Taipy Scheduler.
A scheduled method is usually created and returned by the Scheduler.every() method,
which also defines its interval.
Attributes:
| Name | Type | Description |
|---|---|---|
interval |
int
|
A quantity of a certain time unit. |
scheduler |
Scheduler
|
The scheduler instance used to schedule the method. |
Methods¶
at() ¶
at(
time: Union[str, time, datetime],
tz: Optional[str] = None,
) -> "ScheduledMethod"
Specify a particular time that the method should be run at.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
Union[str, time, datetime]
|
The time or date when the method gets invoked.
If a string, it must be in one of the following formats:
|
required |
tz
|
Optional[str]
|
The timezone that this timestamp refers to. Can be a string that can be parsed by pytz.timezone(), or a pytz.BaseTzInfo object. |
None
|
do() ¶
do(
function: Callable, *args, **kwargs
) -> "ScheduledMethod"
Schedule a custom function to run.
Any additional arguments are passed on to function when the job runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function
|
Callable
|
The function to run. |
required |
*args
|
list[any]
|
The arguments to pass to the function. |
()
|
**kwargs
|
dict[str, any]
|
The keyword arguments to pass to the function. |
{}
|
do_create_and_submit_scenario() ¶
do_create_and_submit_scenario(
config: ScenarioConfig,
creation_date: Optional[datetime] = None,
name: Optional[str] = None,
)
Schedule the creation and submission of a scenario.
When triggered, create_scenario() is invoked to create a new scenario, then submit() is executed on the
newly created scenario.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ScenarioConfig
|
The scenario configuration used to create a new scenario. |
required |
creation_date
|
Optional[datetime]
|
The creation date of the scenario. If None, the current date time is used. |
None
|
name
|
Optional[str]
|
The displayable name of the scenario. |
None
|
do_create_scenario() ¶
do_create_scenario(
config: ScenarioConfig,
creation_date: Optional[datetime] = None,
name: Optional[str] = None,
)
Schedule the create_scenario() method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ScenarioConfig
|
The scenario configuration. |
required |
creation_date
|
Optional[datetime]
|
The creation date of the scenario. If None, the current date time is used. |
None
|
name
|
Optional[str]
|
The displayable name of the scenario. |
None
|
do_submit() ¶
do_submit(
entity: Union[Scenario, Sequence, Task],
force: bool = False,
wait: bool = False,
timeout: Optional[Union[float, int]] = None,
)
Schedule the submit() method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
Union[Scenario, Sequence, Task]
|
The scenario, sequence or task entity to submit. |
required |
force
|
bool
|
If True, the execution is forced even if for skippable tasks. |
False
|
wait
|
bool
|
Wait for the orchestrated jobs created from the submission to be finished in asynchronous mode. |
False
|
timeout
|
Union[float, int]
|
The optional maximum number of seconds to wait for the jobs to be finished before returning. |
None
|
on() ¶
on(date: Union[str, date, datetime]) -> 'ScheduledMethod'
Specify a particular date that the method should be run on.
This method applies only to monthly and yearly scheduled methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
Union[str, date, datetime]
|
The date when the method gets invoked.
If this parameter is a string, it must be in one of the following formats:
|
required |