LSST CCD Test Job Harness

The individual CCDs and their larger aggregates in the form of RTMs undergo a series of tests. These tests are broken down into atomic jobs (aka "work processes"). Only parts of tests that are implemented by running a software program are considered in this note. The note describes a job harness which controls the execution of these jobs.

Table of Contents

1 Terms

The terms used in this note are defined.

canonical
indicates that an item is globally known to all parts of the testing system. In particular sites and jobs have canonical identifiers.
site
the context in which a collection of tests are made (eg, "BNL").
unit
A unit of testing (eg, a CCD or an RTM)
test
production of data from the examination of a unit or from analyzing output from another test.
job
any type of test (or portion of a test) that is implemented by executing a software process (or multiple, related processes) and producing one or more files containing the results of the test.
station
a physical test that generates data by takeing measurements of a unit either by human labor or by invoking a software process.
analysis
a pure software test operating on the output files of another test and producing derived output files of its own.
archive
the root of a site-central, organized file-system hierarchy storing all result files of all jobs.
stage
the root of a file-system local to the computer running a job. It temporarily stores the job's output files and, where needed, holds a temporary copy of the output of prior jobs needed as input to the current job.
operator
an identified individual charged with running a job
LIMS
the Laboratory Information Management System. It consists of a central database and fronting web application for storing job result summaries, meta-data bookkeeping and providing driving input to the job harness.

2 The Job Harness

The job harness ties together the LIMS, the running of individual job implementations and their result files. It enforces a uniform interface between LIMS and the jobs and between jobs and the file archive. It hides unneeded details of invoking a job from an operator.

3 Cycle of job execution.

The role of the job harness is described by breaking down the cycle of executing one job.

3.1 Input parameters

A cycle starts by determining the input parameters to a job. A these parameters include:

unit
the type of unit being tested (eg CCD or RTM)
ID
the unique identifier of the unit
name
the canonical name for the job that will be run
version
the released version of the job software

It is outside the scope of this document to state how the values of these input parameters will be determined however it is expected that they will ultimately be derived from a LIMS database query.

3.2 Harness Invocation

The harness is implemented in Python and can be invoked as a command line program or as part of a larger Python program.

3.3 Initial Environment

The job environment is built in three steps. It is initialized from the environment from which the harness is invoked (FIXME: should we limit this?) to which variables are added to expose the input parameters:

LCATR_UNIT
the type of unit being tested
LCATR_UNIT_ID
the unique identifier of the unit
LCATR_JOB
the canonical name of the test
LCATR_VERSION
the version string for the job's software

3.4 Static Job Environment

The environment is then amended to use environment Modules (see http://modules.sf.net/) and to load the module specific for the given job. Details of this step are described in the note on "Describing LSST Sensor Test Software Environment with Modules". The module loaded is determined by the canonical name and version given as input parameters. If loading fails the harness aborts.

3.5 Job ID Allocation.

Every job has an associated, unique identifier. This identifier is allocated from LIMS based input parameters described above and these additional items:

username
user name of the account that invoked the harness (taken from the environment variable USER).
hostname
the fully qualified host name of the computer running the harness (taken from the OS)

The allocation is done by making an HTTP query on the LIMS web front end. The query supplies the these parameters and returns the allocation in the form of an HTML file containing the job identifier.

3.6 Input Dependencies Resolution

Some jobs require that the output files of prior jobs are available as input. The harness resolves these dependencies by a call to a LIMS web service1 in much the same was as the job identifier is allocated. The query returns the previously registered input parameters and associated job ID for all successfully completed jobs on which the current one depends. In the case where multiple jobs of any type have been run it is up to LIMS to determine which one shall provide the input to the current job.

3.7 Final Job Environment Configuration

Based on the allocated job ID and any input dependencies the job environment is updated to include variables of the form:

LCATR_OUTDIR
the directory (relative path rooted on either the local stage or the archive) from which the job will run and which will contain any and all output files.
LCATR_<dep>_OUTDIR
the directory (relative path rooted on either the local stage or the archive) to find any files produced by prior jobs on which the current job depends. There is on variable for each prior job named <dep>.

3.8 Staging and File System Checking

The local stage file system is checked to assure that LCATR_OUTDIR does not exist. The archive is checked for the existence of all LCATR_<dep>_OUTDIR directories. If these checks fail the harness aborts.

The LCATR_<dep>_OUTDIR directories are copied from the archive to a corresponding location on the local stage and the LCATR_OUTDIR directory is created and becomes the harness's current working directory.

3.9 Production Step of the Job

The production program, as specified by the LCATR_JOB_PRODUCER environment variable, is executed. Standard output and error are logged. If the returns a failure code (non-zero) the harness aborts.

3.10 Validation Step of the Job

The validation program, as specified by the LCATR_JOB_VALIDTOR environment variable, is executed. The validator is expected to perform the following tasks:

  • Run any job-specific validation on the produced files and return a non-zero code if validation fails.
  • Produce one or more result summary files (see note on "LCATR Schema")

Standard output and error are logged. If the returns a failure code (non-zero) the harness aborts.

3.11 Archiving

The contents of the current directory are copied into LCATR_OUTDIR rooted at the archive.

3.12 Termination

At exit the job harness notifies LIMS about the completion of the job by making a web service call that includes the following information:

Job ID
the job identifier previously allocated
status
a status code indicating nominal success or a description of a failure if it occurred (and was caught).

3.13 Clean up

Files in the stage are removed.

Details of each step are given in the following subsections.

4 Configuration

An instance of a job harness may be configured from a variety of sources: environment, configuration files or explicit arguments. The parameters are resolved in four steps:

  1. The run-time environment initializes the set of configuration parameters.
  2. Configuration files are checked and any parameters defined in named [DEFAULT] will update the configuration.
  3. Explicit arguments are applied to the configuration.
  4. The configuration files are checked again for any sections named after an existing parameter and value

Specifics of each configuration step are given in the following sections.

4.1 Configuration through the environment

Configuration parameters may be specified with environment variables. Their names should be constructed by the capitalized parameter name with {{{envprefix}}}.

4.2 Configuration files

Zero or more configuration files may be read by the harness. The files checked are:

~/.lcatr.cfg
./lcatr.cfg

They may provide configuration parameters in two ways. First, the [DEFAULT] section overrides parameters supplied by environment variables but may be further overridden by those explicitly supplied (see below)

Second, after the command line parameters are applied the files are checked a second time for any sections that match the key/value name of any existing parameters. For example a section named [site BNL] matches the parameter site with the value BNL. Any parameters listed in the section will be applied. If they are not yet set they will be but they will not override previously set parameters. That is, they provide a set of default tied to the setting of some other parameter.

This last step in resolving the parameters is general but intended to only be used for the high-level parameters such as context, site, local and job.

4.3 Explicit arguments

The main Python job.Job class constructor takes as keywords zero or more parameters. The command line invocation of the harness can be given zero or more parameters using command line arguments like:

--parameter=value

These explicit parameters will override any of the same names provided by the environment or by any [DEFAULT] sections of configuration files.

4.4 List of Configuration Parameters

The configuration parameters understood by the harness are:

context
an identifier of a combination of site, local and job.
site
a (canonical) identifier for a site.
local
an identifier for the computing environment (machine) running the harness.
job
a (canonical) identifier for a job.
version
a version string matching a Git tag used to make a release and installation of the software for a job.
operator
the username of the account invoking the harness
archive_root
the absolute path to the root of the archive file system.
archive_user
the username that can access a machine with archive_root mounted via SSH.
archive_host
the host name of the computer that has the archive file system mounted.
stage_root
the absolute path to the root of the stage file system.
dependencies
a colon-separated list of job name/version pairs on which the current job depends.
modules_home
a local directory containing the installation of Modules (specifically containing the init/ sub directory)
modules_version
the version of the Modules installation .
modules_cmd
the path to the modulescmd program.
modules_path
a colon-separated path of in which to search for modulefiles.

5 External requirements

The following things must be provided before the job harness can run

5.1 Authentication

The job harness will need to run from an account that can access the archive server via SSH. This is needed to perform existence checks on the archive and to copy files between the archive and the local stage. For unattended running it is strongly recommended to setup an SSH key pair such that a phassphrase/password need not be given interactively while jobs run.

5.2 Environmental Modules

As described above, the job harness relies on externally defined environmental Modules. It is expected that the Modules support programs are already installed and that the suite of job-specific modulefiles exist. Their locations may be specified in the harness configuration file, previously set up using standard Modules environment variables or the harness will attempt to guess the locations.

Footnotes:

1 There is a mode used for testing where such dependencies are resolved through guesses made based on the contents of the archive.

Author: Brett Viren <bv@bnl.gov>

Date: 2014-10-03 11:45:53 PDT

HTML generated by org-mode 6.21b in emacs 23