ScheduledTask

ScheduledTask[expr,timespec]
represents a scheduled task to be evaluated on the schedule defined by timespec.

Details and OptionsDetails and Options

  • CloudDeploy[ScheduledTask[]] sets up a scheduled task in the cloud.
  • Scheduled tasks in the cloud can be controlled using functions like StopScheduledTask and StartScheduledTask.
  • 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
    dtrun 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
    Nonerun on demand only
  • The time interval dt should be given as a Quantity object.
  • In DateObject[patt], the pattern patt has the form , where later elements can be dropped, and where each element can be a literal integer, a choice of integers of the form , 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:
  • AutoRemoveFalseremove last run scheduled task
    NotificationFunctionAutomatichow to provide notifications
    TimeZoneAutomatictime 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.

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Create a scheduled cloud task that logs the date and temperature hourly:

In[1]:=
Click for copyable input
Out[1]=

Delete the task:

In[2]:=
Click for copyable input
Out[2]=

Create a scheduled cloud task that emails the task owner the temperature daily for the next month:

In[1]:=
Click for copyable input
Out[1]=

Delete the task:

In[2]:=
Click for copyable input
Out[2]=

Create a scheduled cloud task that logs the opening price of a financial instrument on weekdays:

In[1]:=
Click for copyable input
Out[1]=

Delete the task:

In[2]:=
Click for copyable input
Out[2]=

Create a scheduled cloud task that updates a time stamp in the cloud once a day:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Get the current time stamp:

In[4]:=
Click for copyable input
Out[4]=

Run the scheduled task cloud object using RunScheduledTask:

In[5]:=
Click for copyable input
Out[5]=

The time stamp has been updated:

In[6]:=
Click for copyable input
Out[6]=

Delete the task:

In[7]:=
Click for copyable input
Out[7]=
Introduced in 2014
(10.0)
| Updated in 2015
(10.1)
Translate this page: