Skip to content

DHI Services Job Runner

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 Worflow 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.

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 must be configured:

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

  • The 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.

  • The 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.

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

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

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).

Running

By default, the startup type of the Job Runner service is set to "Automatic", so it will automaticly 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.

Job Runner events (including possible errors) are logged to the Windows Application Event Log and can be investigated through the Windows Event Viewer.