Introduction
Standalone Jobs and Order Jobs
JobScheduler comes with two types of job that can be used to carry out workflow automation tasks - Standalone Jobs and Order Jobs.
Standalone Jobs are simple to configure and are often used in simpler job scheduling environments. They are also often used where users have migrated from other job scheduling systems such as TWS which are based on a similar concept. However, Standalone Jobs are neither as flexible nor as powerful as Order Jobs.
Order Jobs are run in Job Chains and can be executed both sequentially and in parallel. Order Jobs require an Order before they can run. Orders are triggers that start a Job Chain and convey information about the state in the job chain corresponding with the job that is being run. Orders can also have a payload of parameters that are processed by individual Jobs. These concepts are explained in more detail in our Concepts for jobs, job chains and orders article. In addition, our Job Chains article illustrates some of the basic Job Chain patterns that can be implemented with JobScheduler.
Required Knowledge
How are Jobs, Job Chains and Orders Configured?
- JobScheduler objects (jobs, job chains, orders, schedules, process classes and locks) are all configured using plain XML files. These files are saved in the so-called Live Folder (the default location of this folder or directory is
./config/live
, relative to the scheduler_data directory). The configuration for every JobScheduler object is saved individually in this folder or one of its sub-folders. - Changes to these object configuration files become effective without a restart of the JobScheduler being necessary, although on Unix® systems it may take up to a minute for a change to become effective.
- Objects can be created and modified using JOE - JobScheduler Object Editor. New objects are configureded by either duplicating an already existing object in JOE, and then modifying it, or by creating and configuring a completely new object.
- A text editor could also be used to create and modify objects but working in this way requires detailed knowledge of the XML structure of each JobScheduler object (see the JobScheduler Reference documentation for more information).
- Jobs and Orders are run - i.e. started, paused, stopped, etc. - and monitored using the JOC Cockpit interface. This interface also allows job starts configured with JOE - in the form of either Run Times or Schedules - to be temporarily overwritten. The JOC Cockpit also allows users to review the current workplan and history.
Other tutorials in this series
- JobScheduler - Tutorials - Introduction and Requirements
- JobScheduler - Tutorial 1 - Running a simple job using the JOC Cockpit
- JobScheduler - Tutorial 2 - Editing a Simple Job with JOE
- JobScheduler - Tutorial 3 - Running an Order Using the Run Time Parameter
- JobScheduler - Tutorial 4 - Configuring and Running a JITL Job
- JobScheduler - Tutorial 5 - The YADE JITL Job - Configuring and running file transfer jobs
- JobScheduler - Tutorial 6 - Configuring and Running Standalone Jobs (this article)
Getting Started
- Start JOE (the JobScheduler Object Editor) using one of the following scripts:
%SCHEDULER_HOME%\bin\jobeditor.cmd
( Windows™ )$SCHEDULER_HOME/bin/jobeditor.sh
( Unix™ )- Once started JOE should look similar to the screenshot:
- Open the live folder in JOE:
- Use the key combination ctrl+D or
select File -> Open HotFolder from JOE's main menu or click the red folder icon in the menu bar.
The live folder should be selected by default: if not, navigate to./config/live
. - Add a folder for your Standalone Jobs using the Make New Folder button as shown in the screenshot below:
Configuring a Standalone Job
There are two ways to set up the Standalone Job for this tutorial. Either:
Download the Configuration ....
The Standalone Job is available for Windows as an attachment to this article (tut_6_standalone_job.zip) and can be downloaded if required and unpacked in the Live folder.
... or Do It Yourself
The Standalone Job can be easily configured in JOE.
- Once the standalone_jobs folder configured in the first part of this tutorial has been opened in JOE, click on the Jobs element in the left hand Scheduler Elements pane. This will open the Jobs panel as shown in the next screenshot:
- Now click on the New Standalone Job button to create a first job. This new Job, with Name job1, will be shown in both the Jobs and Scheduler Elements panes:
- Click on the job1 element in the Scheduler Elements pane to allow the Job to be configured as shown in the next screenshot:
For the purposes of this tutorial we only need to configure:- the Job Name and
add a simple script using the code from one of the following code blocks, according to the operating system:
Example Script: for Microsoft® Windows®@echo off echo %SCHEDULER_JOB_NAME% is running echo Current Timestamp: %DATE% %TIME% exit %ERRORLEVEL%
Example Script: for Unix®#!/bin/sh echo "$SCHEDULER_JOB_NAME is running" echo "Current Timestamp: `date`" exit $?
- In addition, the Job has been given a Title, although this is not mandatory.
- The Job can now be saved using the Save Configuration icon near the top of the browser window.
Running the Standalone Job
- Open the JOC Cockpit.
You open JOC in a browser by entering the address such ashttp://localhost:4446/joc/
The exact address along with the account name and password you will require to log in will have been set by the system administrator that installed the JOC Cockpit. - Once you have logged in to the JOC Cockpit you will see the Dashboard view, which presents an overview your system as shown in the next screenshot.
- Change to the Jobs view by clicking on the button Jobs item in the main menu bar at the top of the window.
Standalone Jobs - and their containing folders - are only visible in this view
Click on the Job in the left hand part of the window to open a detailed view of the Job in the right hand part. Start a task for this Job by clicking on ->Start task immediately in the Job menu, as shown in the screenshot below.
The task will now start to run and you can follow its progress in the Task history by clicking on the current task history entry as shown in the next screenshot.
This will open a new browser window with the log output, where, amongst other things, you will be able to read the output from the shell script.
Congratulations!
You have successfully configured and run your first Standalone Job.
Scheduled Job Starts
In the following example a Standalone Job is configured to start daily at 12:00 o'clock and at 14:00.
You will find the Run Time->Everyday function in the element tree in the left hand pane of JOE: this is a sub-element available for both Jobs and Orders. Use the New Period button (positioned on the right hand side) to add a new start period. Use the Apply Period button to save your input after you have selected Single Start 12:00:00 in the Start Time field. Repeat this procedure for Single Start 14:00:00.
Note that in addition to the fixed start times (Single Start), it is also possible to set the following starting modes:
- repeat intervals (Interval end/start, Interval start/start).
- run-time period when a Job is to be started outside of the Job's time period, the Job will be queued and started once its run-time period has been reached.TO CHECK
Standalone Jobs can still be started manually, regardless of whether a start time or run period has been set. It is also possible to combine the scheduled starting of a Standalone Job with Directory Monitoring.
Configuration as XML
The code used to specify the firstJob job at the times specified in schedule1 and with the Directory Monitoring also described is shown in the code block below:
Further References
A Overview of the JobScheduler Documentation