Scheduling workflows

In this recipe, you will learn how to schedule workflows. Scheduled workflows will automatically run at given times and intervals.

Getting ready

We need at least one workflow we can schedule. The workflow should not contain a user interaction.

How to do it...

  1. Right-click on the workflow you would like to schedule and choose Schedule workflow.
  2. Select Task name. By default, the task name is set to be the workflow name. A good naming standard comes in handy here, especially if you schedule recurring tasks.
  3. Set a start date and time.
  4. If this task has been scheduled in the past, you can still run the workflow. This setting is useful if a task had been scheduled but during the planned execution time, Orchestrator server was not available (for example, powered off). The task will then start as soon as Orchestrator server is available again.
  5. You can create a recurring task. You have the base setting for every minute, hour, day, week, and month. Except for the week setting, you can schedule multiple executions by clicking on the green plus sign. So, you can, for example, set a task that runs every day at 9 AM and 9 PM.
  6. Last but not least, you can set a stop date and time at which the recurring task will stop.
  7. Click on Next to get to the in-parameters for this workflow. Fill them out as required and when finished, click on Submit.
  8. Orchestrator will now automatically jump into the Run | Scheduler view and show you the scheduled task:

    How to do it...

How it works...

Using the Orchestrator scheduler allows you to make sure certain tasks are running at a specific time. There are multiple examples. There is a maintenance task that is scheduled to run every evening to disconnect all CD-ROM drives from VMs or a provisioning/decommissioning task that you want to enact at a certain time. However, you could also use a policy for this, see the Working with policies recipe in Chapter 8, Better Workflows and Optimized Working.

You can manage all scheduled tasks from the Run | Scheduler view. Here, you can review all the relevant information for all the scheduled tasks. The information provided includes what workflow it is currently running when the last run was made, and when it will run next; you also see the in-parameters (Parameters) you have supplied to the workflow. By right-clicking on the task, you can suspend and resume it as well as cancel/delete and edit it. When editing the task, you can change all settings with regard to the scheduling; however, you cannot change the workflow you have scheduled or the in-parameters you entered when you scheduled the task:

How it works...

If you click on the Workflow Runs tab, you can see all the information for each run. You see the start and end time as well as the workflow state (waiting, failed, completed, canceled, running). If the workflow is currently running, you can see which element of the workflow is currently running (Current item) as well as its business state:

How it works...

In addition to this, you can also schedule and monitor a scheduled task from vCenter. In the vCenter Web Client, click on vCenter Orchestrator and then on Scheduled workflows.

There's more...

You can interactively schedule a workflow using a workflow. A typical example for this is a workflow that requests a VM but then schedules the actual provisioning at a later date and time. To do this, just use the Schedule workflow schema element that you find in the Generic section. This element only schedules tasks once; it doesn't allow recurring tasks.

You can schedule workflows using JavaScript. By using the two Workflow.schedule() and Workflow.scheduleRecurrently() methods, you can now schedule this workflow. Have a closer look at the Schedule workflow schema element; the Workflow.schedule() method is used there.

See also

See the example workflow 5.8.1 Schedule me! and 5.8.2. Automatic schedule.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset