ScheduledTask
ScheduledTask[expr,timespec]
represents a scheduled task to be evaluated on the schedule defined by timespec.
Details and Options
- CloudDeploy[ScheduledTask[…]] deploys a scheduled task to be executed in the cloud.
- SessionSubmit, LocalSubmit and CloudSubmit submit scheduled tasks for background evaluation in the current session, on the local system or in the cloud.
- Submitted tasks can be controlled using TaskSuspend, TaskResume, etc.
- The argument expr can be the Wolfram Language code to be evaluated, or a CloudObject or File containing Wolfram Language input.
- The following timespec specifications can be given:
-
"Hourly" run once an hour "Daily" run once a day "Weekly" run once a week "Monthly" run once a month "Yearly" run once a year dt run at a specified time interval DateObject[patt] run at times matching the specified pattern {timespec} run only once ever {timespec,count} run only count times ever "cronspec" run at times specified by a Unix cron specification {start,timespec} commence runs on date start {timespec,end} end runs on date end {start,timespec,end} run between dates start and end None run on demand only - The time interval dt should be given as a Quantity object.
- In DateObject[patt], the pattern patt has the form {y,m,d,h,m,s}, where later elements can be dropped, and where each element can be a literal integer, a choice of integers of the form n1n2…, or _ representing any possible value. For the day element, literal days can be replaced by symbols indicating a day of the week, such as Monday.
- The following options can be given:
-
AutoRemove False remove task after its last scheduled run NotificationFunction Automatic how to provide notifications TimeZone Automatic time zone for scheduling - For purposes of NotificationFunction, a task is considered to have failed if its output is $Failed or a Failure object.
- In the cloud, the precise times at which scheduled tasks are run are typically determined by load-balancing requirements.
- The minimum time between repetitions of a task in the cloud is determined by cloud configuration and policies and will typically be a certain fraction of an hour.
Examples
open allclose allBasic Examples (6)
Create a scheduled task in a local session:
Create a scheduled cloud task that logs the date and temperature hourly:
Create a scheduled task on a separate kernel:
Create a scheduled cloud task that emails the task owner the temperature daily for the next month:
Create a scheduled cloud task that logs the opening price of a financial instrument on weekdays:
Create a scheduled cloud task that updates a time stamp in the cloud once a day:
| In[1]:= |
| In[2]:= |
Run the scheduled task cloud object using TaskExecute:
Generalizations & Extensions (1)
Options (1)
Applications (1)
See Also
AutoRefreshed Delayed TaskSuspend TaskExecute TaskRemove DocumentGenerator Once
Related Guides
Introduced in 2014
(10.0)
| Updated in 2017 (11.2)