Skip to content

DHI Services Job Runner

NOTE: The Job Runner is obsolete and has been replaced by the Job Orchestrator.

The DHI Services Job Runner is a Windows Service for executing jobs.

alt text

Job execution is requested through the Jobs API and is queued as pending jobs in one or more job repositories for further processing by the Job Runner.

The Job Runner regularly polls the job repositories for pending jobs and initiates job execution - either locally or on dedicated remote resources (job hosts).

alt text

The Job Runner manages one or more job workers that can run different types of jobs - for example Windows Workflow Foundations (WWF) sequences. For configuration of these job workers - including the type of tasks, and the pool of job hosts - see Configuration below.

Installation

The Job Runner must be installed using DHI.Services.JobRunner.Install.bat. Open a command prompt in administrator mode and run the batch file.

To uninstall the Job Runner Service, open a command prompt in administrator mode and run DHI.Services.JobRunner.Uninstall.bat.

For detailed information about installing the Job Runner service, see Deploying the Job Runner service.

Configuration

worker-connections.json

The worker-connections.json file is used to configure one or more job workers. For each of the job workers, the following settings can be configured:

  • JobRepositoryType and JobRepositoryConnnectionString are used to establish the connection to the job repository.

  • TaskRepositoryType and TaskRepositoryConnnectionString are used to establish the connection to the task repository. Tasks are the actual chunks of work that can be executed as jobs. Tasks can for example be Windows Workflow Foundation (WF) workflows stored in a workflows.json file.

  • WorkerType is the concrete IWorker-implementation to actually perform the job execution. The WorkerType must obviously be compatible with the tasks in the task repository.

  • HostRepositoryType and HostRepositoryConnnectionString are used to establish the connection to a job host repository. Job hosts are resources (machines) for job execution. These settings are optional and are only relevant if the selected worker type supports remote execution.

  • DefaultHostGroup defines a default host group if the host repository is grouped. This setting is optional.

  • The LoadBalancerType can be used to establish an alternative to the default load balancing mechanism - for example using Azure VM Scale Sets. This setting is optional.

  • The LoggerType and LoggerConnnectionString are optional settings and should be omitted if the selected worker type does not support injection of a logger.

For detailed information about how to configure the job worker connections, see Job Worker Connections.

DHI.Services.JobRunner.exe.config

The DHI.Services.JobRunner.exe.config file contains various configurable settings:

  • JobTimeout: The maximum time that a job can run. If it is not completed within this time period, it is considered "lost" and will be marked with the status "Error".

  • MaxAge: The time period to keep job-records in the job repository. Jobs older than this will be automatically removed from the job repository.

  • ExecutionTimerIntervalInSeconds: The time interval for polling the job repository for pending jobs.

  • CleanningTimerIntervalInMinutes: The time interval for performing various "cleaning" of the job repository. This include removing obsolete job records and discarding long-running jobs (according to the above settings). If CleanningTimerIntervalInMinutes is set to 0, no automatic cleaning will be performed.

  • LoggerType: The type of the logger.

  • LoggerConnnectionString: The logger connection string.

  • ScalarRepositoryType: The type of the scalar repository.

  • ScalarRepositoryConnectionString: The scalar repository connection string.

  • ScalarServiceLogging: If true, the scalar service logging is enabled.

  • EnableScalarService: If true, the scalar service is enabled.

  • VerboseLogging: If true, verbose logging is turned on.

For detailed information on how to configure the Job Runner executable, see Job Runner executable configuration.

When configuring the Job Runner - the worker-connections.json file as well as the DHI.Services.JobRunner.exe.config file - the settings can be read from an environment variable instead of directly from the configuration file. This is especially useful if the setting contains sensitive information such as account credentials. To read a configuration setting from an environment variable, use the following syntax "[env:{EnvironmentVariable}]".

For example:

<setting name="ScalarRepositoryConnectionString" serializeAs="String">
  <value>[env:MyScalarRepositoryConnectionString]</value>
</setting>

Running

By default, the startup type of the Job Runner service is set to "Automatic (Delayed Start)", so it will automatically start when the hosting machine is restarted.

The Job Runner can be safely paused, which will temporarily stop the polling for pending jobs until the service is resumed.

If the service is restarted, the state of all jobs in progress will be lost, and the state of these jobs will be changed to "Unknown" - even if they might eventually complete successfully.

The job runner will continuously remove obsolete job-records and check and handle the state of (too-)long-running jobs according to the above configuration settings.