Job tasks#

A job task is always part of an analysis job. A job task represents the progress and outcome of a single worker’s analysis step of a sample. It contains information such as when the worker started and completed, whether it failed or not, and a reference to the analysis result (if it completed successfully).

A job task can be in one of several states that indicate the outcome of its analysis. The possible task states are enqueued, executing and the final states successful, timeout, failed, and cancelled.

  1. Enqueued or Executing: These are non-final states used when a new job is registered or while the analysis is being performed.

  2. Successful: A task in this state has completed its analysis and may produce a result with a score ranging from 0 to 100. A score of -1 indicates uncertainty in the analysis.

  3. Failed or Timeout: If a task is in either of these states, the system will use the previous analysis result from the same worker to compute the verdict.

  4. Cancelled: Tasks in this state are excluded from the verdict calculation.

The Sample service automatically creates tasks for every job, exactly one task per worker which should analyse a particular sample as part of a single job.

Updating job tasks#

The role SAMPLEDB-ANALYZER is required to be able to update job tasks.

As the task progresses, the state and result should be updated. This can be done using the job task endpoint using the PUT operation. The response body will be in JSON format, and contain the updated job task.

curl -X PUT -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" https://api.mnemonic.no/sampledb/v2/job/<job id>/task/<task id> -d '{
	"state": "success",
	"analyses": [ "7512c89c-2308-4d4c-86af-94462b6ac3ad" ]
}'

For more detailed information on what the response model looks like, you can check out the Swagger API documentation.

Fetching job tasks#

The role SAMPLEDB-VIEWER or higher is required to be able to fetch or list job tasks.

List#

To list job tasks, the job task endpoint can be used with a GET operation. The response body will be in JSON format, and contain a list of objects containing information about the tasks.

curl -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/sampledb/v2/job/<job id>/tasks

Fetch#

To fetch a single instance of an analysis job task, the fetch job task endpoint can be used with a GET operation along with the Job ID and Job Task ID. The response body will be in JSON format, and contain all information about the job task.

curl -H "Argus-API-Key: my/api/key" https://api.mnemonic.no/sampledb/v2/job/<job id>/task/<task id>

For more detailed information on what the response model looks like, you can check out the Swagger API documentation.