IronWorker tasks are flexible; they don't have to be queued immediately. Rather, you can schedule a task to be queued at a specific time or after a set amount of time. This article shows you how to create them using the iron_worker_ng Ruby gem

Scheduled jobs are separate resources than queued tasks. When scheduled tasks run, they queue a task to execute the worker code. The Scheduled Task has a Scheduled ID. The task that executes is separate and has a distinct Task ID. You monitor Scheduled Tasks in the Schedule tab in the HUD. Tasks that subsequently queued can be monitored within the Task tab.

Table of Contents

API Reference


POST /projects/{Project ID}/schedules

URL Parameters


The request should be a JSON object with a "schedules" property containing an array of objects with the following properties:

Optionally, each object in the array can specify the following properties:

Best Practices

Schedule Task via HUD/Dashboard

We've added a easy to use GUI to help you create and manage your schedules.

  1. Click on the create schedule button on our schedule's page in the dashboard
  2. Fill in the relevant parameters for the scheduled task you want to create
  3. Click on the create schedule button on our schedule's page in the dashboard
  4. You can now view your current, past, and deleted scheduled in the list view.
  5. If you click on a schedule you have the ability to view the details and edit/update your schedules accodingly. note: updating a schedule will delete the old one and create a new one.

Scheduling with the Ruby Client

Scheduling a task to be queued at a specific time is easy:

schedule = client.schedules.create('MyWorker', payload, {:start_at => + 3600})

To run on a regular schedule, then just include an interval to repeat execution of the scheduled task. (This is useful, for example, for sending out daily notifications or cleaning up old database entries.)

schedule = client.schedules.create('MyWorker', payload, {:run_every => 3600})
# will be run every hour

These repeating tasks can also be set to queued at a specific start time:

schedule = client.schedules.create('MyWorker', payload, {:start_at => + 3600, :run_every => 3600})
# will be run every hour, starting an hour from now

You can also schedule a task to be queued after a certain delay:

schedule = client.tasks.create('MyWorker', payload, {:delay => 3600})
# queues the task after one hour

Note:You can use a delay for a scheduled job and for a queued task. The difference is a delayed scheduled task will kick off a regular task whereas a delayed task executes directly (after the delay). We suggest using a delayed task if the delay time is brief; a scheduled task if it's longer into the future and/or repeats frequently. See the note below, however, on good practices especially for large numbers of individual tasks to run in the future.

Finally, you can also control how many times a repeating task is run:

schedule = client.schedules.create('MyWorker', payload, {:start_at => + 3600, :run_every => 3600, :run_times => 24 })
# will be run every hour for one day, starting an hour from now