Job Scheduling

◷ Reading Time: 9 minutes

Introduction

Use jobs to run your services seamlessly and concurrently using different agents.

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:

  1. Service – this is where the business logic is handled.
  2. Job – the definition of when to run the service.
  3. Agent – the node that hosts the service and job.

Set up the Service

1. Available services can be viewed at Execution Server > Services

2. Click on Edit under Actions

3. Service details can be viewed.

From this window,

  • Title
  • Key

are required to create a job. And also, the service should be enabled

Set up the Job

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

2. Change the settings under the General tab.

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
  • Tags: Assign tags to the job
  • Effective From and Expires At: Starting and ending 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 * , – /

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

4. Click Save.

5. Activate the job if it is inactive.

View Job Logs

Job information including job executing times, running services, requests, responses, and exceptions of the job can be viewed under Logs.

1. Go to Execution Server --> Jobs and click on Logs. You will see the logs of the job.

2. Click on Job Information to view the information.

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

4. To delete the job click on Delete.

Set up an Agent

  • To view the existing agents, go to,
Administration --> Agents
  • Click Edit under Action to assign the agents to jobs
  • An agent connects to a service/ services according to the tags which should be defined in this window.

Address

  • Name: Name of the agent
  • Is Active: Enable or disable the agent
  • Description: Role description
  • Host Url: Agent’s hosted URL

Distributed Scheduled Jobs

  • Allow Agent to Run a Job: Change the ability of the agent to run a job
  • Tags: Tags of the service/ services to run
  • Capacity: How many jobs the agent should run concurrently

Troubleshooting

If your jobs are not starting or running correctly, ensure the following.

  • The agent should have permission to run a job.
  • Both Master and Agent should run.
  • Master and Agent should run as an Administrator.
  • If you have assigned any Tags, those Tags in Agent and Jobs should match.
Tag from the job
Tag from the agent
  • Both Agent and Job should be enabled.
Job is active
Agent is active
  • The IP address and port that the agent is listening on must match the URL set for the agent in the Workbench.

Video Tutorial

Updated on September 27, 2022

Was this article helpful?

Related Articles