13.1.3. Job Processors

A Job Processor allows the user to configure how received DICOM instances will be associated with one or more configured Clara pipelines. Each configured Clara SCP AE Title must have one processor configured; if omitted, the default AE Title Job Processor is used.

AE Title Job Processor is the default Job Processor used if not specified in the configuration.

For example, this job processor can group received instances by Study Instance UID (0020,000D) so that all received instances with the same Study Instance UID are used to trigger the configured Clara Pipeline(s).

13.1.3.1.1. Configuration

AE Title Job Processor allows the following parameters to be customized:

  • priority: The priority of the job to use during creation of the Clara pipeline-job. Allowed values are lower, normal, higher, immediate. Please refer to Clara Platform for additional details on job priorities.
  • timeout: The number of seconds to wait before creating a new Clara pipeline job (minimum 5 seconds).
  • pipeline-*: Any settings that are prefixed with pipeline- tell the job processor that it’s a Clara pipeline and a new Clara pipeline job shall be created with the received instance(s).

13.1.3.1.1.1. Examples

13.1.3.1.1.1.1. Scenario 1
Copy
Copied!
            

"priority: "normal", "timeout": 60, "pipeline-lung": "8abf244aff7647989d4f6b3987a85759", "pipeline-heart": "c5f996a71e1d4959bd6a2c8cf7130f88", "pipeline-breast": "eb48c784ef20425580db7d46a30829b2"

With the settings above, the job processor will wait for 60 seconds before composing three Clara pipeline jobs, one for lung, one for heart, and one for breast.

For example, if there are five studies for Patient X, and each of these studies were sent to DICOM Adapter in a separate DICOM association within 60 seconds, then three Clara pipeline jobs are created, each with all five studies.

13.1.3.1.1.1.2. Scenario 2
Copy
Copied!
            

"priority": "higher", "pipeline-breast": "8abf244aff7647989d4f6b3987a85759"

In this scenario, the job processor will group received instances with timeout set to 5 seconds.

For example, if studies A, B, and C are all sent over in one DICOM association, and no additional instances are sent afterwards, then after five seconds, three breast pipeline jobs are created, one for each study.

As another example, there is one study with four instances, and all four instances are sent in a separate association: The 2nd instance is received at T1+4 (where T1 is the time when 1st instance was received); the 3rd is received at T2+3; and the last at T3+1. In this case, one Clara pipeline job will be created with all four instances.

By extending JobProcessorBase, which is found in Nvidia.Clara.Dicom.API.dll, developers can customize their inference job submission workflow.

The following code snippet contains the properties and methods that are required when implementing a Job Processor.

Copy
Copied!
            

public abstract class JobProcessorBase : IDisposable, IObserver<InstanceStorageInfo> { public abstract string Name { get; } public abstract string AeTitle { get; } public abstract void HandleInstance(InstanceStorageInfo value); }

  • Name: The name for the job processor.
  • AeTitle: The AE Title that the processor is attached to.
  • HandleInstance(...): Contains a detailed implementation of how a job processor handles received instances.

To submit a job in the HandleInstance(...) method, developers can simply call base.SubmitPipelineJob(...), giving the name of the job, the pipeline ID that has been registered with Clara Platform, the priority, and the DICOM instances to be associated with the job.

Once job submission is completed, RemoveInstances(...) should be called with the instances so the DICOM files in the temporary storage can be cleaned up by the Storage Space Reclaimer Service.

13.1.3.2.1. Sample Snippet

Copy
Copied!
            

[ProcessorValidation(ValidatorType = typeof(CustomJobProcessorValidator))] public class MyJobProcessor : JobProcessorBase { public override string Name => "My Custom Job Processor"; public override string AeTitle => _configuration.AeTitle; public override void HandleInstance(InstanceStorageInfo value) { if (value is null) { throw new ArgumentNullException(nameof(value)); }; if (!value.CalledAeTitle.Equals(_configuration.AeTitle)) { throw new InstanceNotSupportedException(value); }; // handle the instance here } protected override void Dispose(bool disposing) { // dispose any resource if needed } } public class CustomJobProcessorValidator : IJobProcessorValidator { public void Validate(string aeTitle, Dictionary<string, string> processorSettings) { // validate all processor settings // throw if anything is invalid // optionally throw on keys/values that are not used } }

ProcessorValidation attribute must be decorated for each derived class of JobProcessorBase and a job processor validator must be provided. The validator must implement IJobProcessorValidator inteface and validate any processor settings passed into the Clara Create AE Title API call, including the CLI.

© Copyright 2018-2020, NVIDIA Corporation. All rights reserved. Last updated on Feb 1, 2023.