◷ Reading Time: 16 minutes
Introduction
Use Jobs and Job Scheduling to run your services seamlessly and concurrently using different Execution Workers.
For example, you can create jobs if you want to automatically do a few tasks concurrently such as:
- Check an exchange rate every day at 8 AM and save it to an Excel file.
- Check stock market rates every day at 8 AM and save it to an Excel file.
To schedule a job successfully requires three components:
- Service – this is where the business logic is handled.
- Job – the definition of when to run the service.
- Execution Worker- the node that hosts the service and job.
Set up the Service to be run in the Job
1. Available services can be viewed at Execution Server > Services

2. Click on Edit under Actions menu of any specific service

3. Service details can be reviewed in the edit view under the General tab. These details are required to create a job.
- Title
- Key
And also, the service should be enabled.

Set up the Job and Job schedule
1. Once you know which service you want to run, the next step is to create a job. For that, go to, Execution Server --> Jobs --> New Job

General tab
2. Change the settings under the General tab. Following is description of the settings:
Information
- Name: Name of the job
- Description: A brief description to describe the job
Activity
- Enables: Make the job available to run or disable
- Reentrant: Run multiple invocations
- Batch Job: Multiple requests to a Service can be batched to one job instance. For creating and managing these Jobs see our article on Batch Jobs.
- Timeout (seconds): *Requires a positive integer value. This defines the timeout duration a job instance will stay running when agent(s) are unresponsive. Once this duration is reached, if the Agent(s) are still unresponsive, the message will be Abandoned.
Activation
- Effective From and Expires At: The Job Schedule specifying the start and end time of the job
Recurring
- Cron: If it is an ongoing job, how often it should run (See [Cron] for more information on how to assign Cron).
The Cron supports the below specification:
| Field name | Allowed values | Allowed special characters |
| Minutes | 0-59 | * , – / |
| Hours | 0-23 | * , – / |
| Day of month | 1-31 | * , – / ? L W |
| Month | 1-12 or JAN-DEC | * , – / |
| Day of week | 0-6 or SUN-SAT | * , – / ? L # |
| Year | 0001–9999 | * , – / |

Service tab
3. Change setting under the Service tab
Package
- Identifier: Package Identifier
- Version: Package version
Service
- Name: Name of the service
- Version: Version of the service
- Key: Key of the service
- Version Strategy: Use Latest/ Earliest
Inputs
- Parameters: If there is an input JSON object, add it here. If using Batch job, enter multiple JSON objects as an array for the input.

4. Click Save.

5. Activate the job if it is inactive.

Set up a Worker to run a Job
- To view the existing Workers, go to,
Administration --> Workers


- Click Edit under Action to assign the agents to jobs
- An agent is made compatible with Jobs and Services via the relevant tabs in edit view
Address
- Name: Name of the agent
- Is Active: Enable or disable the agent
- Description: Role description
- Host Url: Agent’s hosted URL

Jobs tab
Distributed Scheduled Jobs
- Allow Agent to run Jobs: Change the ability of the agent to run a job
- Capacity: How many jobs the agent should run concurrently

Jobs
- Compatible with all Jobs: Allows the Agent to run any jobs

If the Agent is being dedicated to one or several Jobs, leave Compatible with all Jobs unchecked and select the individual Jobs to be assigned to the Agent.

View Job Logs
Job information including job executing times, running services, requests, responses, and exceptions of the job can be viewed under Logs.
Go to Execution Server --> Jobs and under Actions menu of a Job, select Logs. You will navigate to the logs of the selected job.
For full details on Job logs including viewing, filtering and pagination see our Resource Hub article on Job Logs.

Job Instance status details
Queued – When a job instance is placed in the queue for processing.
Completed Successfully – When a job instance is completed without error and result is successful.
Completed with errors – When a job instance is completed but has error in the result. This could be due to errors in the service or request.
Check the View Results option under the Action menu of the job instance for further details.
Retry with Errors – A parent job instance that has errored in a retry attempt.
Check the View Results option under the Action menu of the job instance for further details.
Retry Successfully – A parent job instance that was completed successfully in a retry attempt.
Abandoned – When a running job instance is terminated without completion due to an unresponsive agent.
Job Information
Click on Job Information to view further details of the job.

This displays the Job information details for the selected log of Job Instances.
If the Job is a Batch Job, this will also display the progress of the batch including:
- The percentage executed
- The number of instances executed versus the total Instances of the batch

To see the request, response, and exceptions logs of each execution, click on View Results.

The Job Instance details modal will display and there are three tabs, Request, showing the JSON request object for the job, Response, showing the JSON response object and Exception giving details of any Exception for a Job Instance.


Delete a Job Instance
To delete a job instance, select Delete from the Actions menu of the instance in the Job log list.

Retry Job Instance
Any Job Instances showing a status of Completed with Errors or Abandoned can be requeued for retry execution.
Note: Although the process to retry is the same for these two status. There is a subtle difference in how they are displayed in the Logs view.
In the Job log List view, select “Retry” from the Actions menu of a particular Job Instance that has Completed With Errors or Abandoned Status.

This will open the retry modal where you can modify the request JSON. Do this if the failure was due to an issue with the request format or content.
Selecting Submit will initiate a retry of the original Job Instance including any changes to the request object.

If the Retry succeeds to execute without error the status of the Job Instance will change to Retry Successful and the icon at the far left of the Job Instance will change from a red circle, white cross to a green circle, white tick.
Once a retry has been attempted an arrow will appear on the far left of the Instance in the list view. If you select the arrow icon it will expand a view of all child Retry instances, selecting the arrow icon again to collapse the view.
All child retry instances will be assigned the Completed Successfully or Completed with Errors status. The original failed parent instance will have the status Retry Successfully or Retry with Errors, depending on the result of the retried child instance.
In the Abandoned case, the original parent instance will maintain the Abandoned status. This ensures that instance to still appear under the Abandoned filter.
For any retry child instance, the details of the retry Job Instance can be viewed by selecting View Details from the Actions menu.

In the case of a failed retry, the parent Job Instance Status will change to Retry With Errors and the red circle with a white cross icon will remain. Similarly to above, select the arrow icon to expand the retry child view to see the retry instances.

Troubleshooting
If your jobs are not starting or not running correctly, ensure the following.
- The agent should have permission to run a job.

- Master and Agent should run as an Administrator.

- Both Agent and Job should be enabled.


- The IP address and port that the agent is listening on must match the URL set for the agent in the Workbench.

