The LIMS and Job Harness API

The LCATR job harness communicates with LIMS in order to register job parameters, allocate job identifiers, provide status updates and upload result summaries. Communication with LIMS is also required for registering and later retrieval of job result summary schema. This document describes the communication interface.

Table of Contents

1 Communication

All communication is initiated by a query from the client (harness) in the form of an HTTP POST. Any GET methods are not specified here. There are two sets of commands and each set is rooted in a base URL:

/Results/<command>
for job related commands/queries
/Schema/<command>
for schema related commands/queries

All POST data uses a single keyword jsonObject and a value which is a JSON-encoded string. All responses, including errors, from LIMS are of a MIME type application/json and contain a JSON-encoded string. The form of the JSON strings in a POST query and their return are described for each command below. A successful HTTP query will be indicated with the usual code 200 and this is independent of any potential application-level logic errors.

2 Job Related

There are three LIMS commands related to running a job which the job harness calls. One for registering a new job, one for updating its status and one for uploading a summary of its results. For each command there is specified a query data structure and either nominal return and exceptional data structures. These data structures are, at top level, in the form of a dictionary.

2.1 Common

Beyond the command-specific entries, every query data structure has the following:

jobid
the LIMS ID string returned as part of registrations (note: for registration, this entry is ignored and may be null)
stamp
a time stamp that the client associates with the query. It is of the form of seconds since the Unix epoch.

2.2 Registration

The registration command is requestID. It is used to attempt to register a new job with LIMS and to deliver to the harness a list of any prerequisite jobs that must have completed before the registering one may begin.

The query contains a specific subset of the job's input parameters.

unit_type
the type of unit being tested (CCD/RTM)
unit_id
the identifier of the unit
job
canonical name of the job
version
the version of the software to be run
operator
user name of the account running the harness

The nominal return gives a LIMS job identifier string and a list of the registered information of any jobs on which the requesting one depends.

jobid
the identifier to use for this job
prereq
a list of dictionaries, each with keys named as the post parameters as above plus an additional jobid giving the registered job identifier for each.

If an exception occurs no job identifier is allocated and an error message is returned:

jobid
null
error
a message describing why the job should not run

2.3 Status updates

Status updates are sent to LIMS through the course of the job. The command is update.

The query includes these entries:

step
the canonical name of the step just completed.
status
null if the step completed successfully, otherwise it contains a human readable string that indicates the nature of the failure.

Note, reported failures are fatal and no follow-up status updates should be expected from the job.

The current list of step values is:

configured
the job environment has been configured
staged
files from any prior dependencies have been copied to the local stage and the job's output directory is created.
produced
the primary program of the job (see below) has run successfully
validated
the secondary program validated the output and produced required result summary and meta data files (see below)
archived
files are successfully copied to the archive
purged
local stage area has been cleared (optional)

Both the nominal and the exceptional response has a single key:

acknowledge
null if the status is accepted. If the job should abort this will contain a human readable message explaining why.

2.4 Summary Result Upload

When the job successfully produces a result it will upload a summary via the ingest command. In addition to the common entries this command expects a single additional one:

result
a list of schema-compliant result summary data structures.

Each schema-compliant result summary data structure is a dictionary that contains at least these entries:

schema_name
canonical name for the part of the result that the data pertains to and the schema it follows.
schema_version
the exact version of the schema that the data follows.

The payload of the actual result summary is sent as additional entries. More information about schemas is in the "LCATR Schema" document.

Both the nominal and the exceptional response has a single key:

acknowledge
null if the status is accepted. If the job should abort this will contain a human readable message explaining why.

2.5 Job Status Query

The values that may be reported as described in one of the three sections above can be retrieved by querying LIMS with the status command.

Note: this allows the job harness to rerun individual steps of a job and is intended to facilitate job software development and not to be used for production. As such it is only implemented in the fakelims server and not currently supported by real LIMS instances.

The call indicates which of the three sections is being queried and the job ID the query applies:

jobid
a unique identifier as previously generated by LIMS
status
indicate which type of status: registration, update or summary.

A dictionary is returned which parrots back the same jobid and status key/value pairs used in the call and an additional key/value pair which depends on the value of status or if there was an error.

If an unknown jobid is passed or another error occurs the returned dictionary contains the key error with a string value that indicates the nature of the error. If an error key is included the existence of any other keys is undefined.

If the status argument is registration the returned dictionary has a prereq key that is filled as defined is in the requestID function but additionally has an entry for the requested job ID.

If the status argument is update the return value includes a steps key, the value of which holds a list of dictionaries, one for each status update that has been reported for the job. The keys to these dictionaries are: state (the step name), status (the status which is null unless an error occurred) and stamp (the reported time stamp).

If the status argument is summary the return value includes a result key the value of which is the same list that was reported with the result key in the prior ingest command.

3 Result Summary Schema Related

The LIMS commands related to job result summary schema are described in this section.

3.1 Registration

Before any result summary that follows a particular schema may be accepted to LIMS the schema that describes the result must first be registered. This is done with the LIMS register command. The query consists of a single parameter:

schema
a list of schema dictionaries

Schema representation is described in the LCATR Schema document. Note, only schema descriptions in JSON representation is allowed.

3.2 Retrieve all

All registered schema descriptions can be retrieved with the all command which takes no parameters. The value returned is schema and is a list of the requested schema .

3.3 Individual Retrieval

Registered schema descriptions can be retrieved with the retrieve command. The query consists of a list of dictionaries held in the match parameter, each element of the list is a dictionary with the following parameters:

name
the schema name (required)
version
the schema version (optional)

If the version is not specified the highest (assuming lexical ordered) version is returned.

The value returned is a dictionary with the key schema pointing to a list of the requested schema.

Author: Brett Viren <bv@bnl.gov>

Date: 2014-10-03 11:46:47 PDT

HTML generated by org-mode 6.21b in emacs 23