Installation & Deployment

In this chapter some information in connection with the installation and usage of CalOb are provided.

Installation

The CalOb Package is a standard waf/wtools build project and shall be configured, built and installed accordingly.

The CalOb Control is relying on the following environment variables:

  • DATAROOT: Directory on the host machine in which Output Data Products will be generated. The storage location will be rendered as “$DATAROOT/<cfg key: server.recording.image_dir>”. The ‘image’ sub-directory in “DATAROOT” will be created automatically by CalOb Control, if not existing.

  • CFGPATH: The “CFGPATH” environment variable, is a colon separated list of paths, pointing to possible Resource Directories in which resource data of different kinds are located.

  • INTROOT: In this release, the example configurations delivered with the CalOb Package as well as the libraries, header files and binaries, are installed into the location pointed to by “INTROOT”. This may change in the future.

Note, in accordance with the “Instrument Software Specification”, one system, typically an instrument, shall deliver a ready-to-use Resource Tree as part of the software package. This Resource Tree shall be referenced to by the “CFGPATH” variable.

Deployment Module

Details about the configuration of a CalOb Control instance are given in the “Configuration” chapter in this manual (Configuration).

The CalOb Package provides an SDK that can be used for integrating ‘CalOb solutions’. The default tool, “calobGenerator” is an example of a deployment module.

The example from “ifw-calob/generator” is shown here:

#!/usr/bin/env python3

  import argparse
  import importlib
  import inspect

  from elt.log import CiiLogManager

  from ifw.calob.calob_config import *


  class CalobGenerator:
      """
      @brief Class that calls the SDK and produces a usable application

      @ingroup common
      """

      def __init__(self):
          self.args = self.parse_arguments()
          self.init_parameters()

      def parse_arguments(self):
          arg_parser = argparse.ArgumentParser()
          required_args = arg_parser.add_argument_group('required arguments')
          required_args.add_argument("-c", "--cfg", help="path to the yaml configuration file", required=True)

          arg_parser.add_argument("-l", "--log-level", help="set log level")
          arg_parser.add_argument("-p", "--log-property-file", help="set the log property file")
          arg_parser.add_argument("-n", "--no-history", help="do not consider history stored in the DB",
                                  action="store_true")
          arg_parser.add_argument("-x", "--console", help="output to console", action="store_true")

          return(arg_parser.parse_args())

      def init_parameters(self):

          if self.args.cfg:
              self.cfg = self.args.cfg

          self.cc = CalobConfig(config_path=self.cfg)

          if self.args.log_property_file:
              self.cc.log_property_file = self.args.log_property_file

          if self.args.console:
              self.cc.console_logging = True

          self.cc.load_config()

          if self.args.log_level:
              self.cc.logger.setLevel(self.args.log_level)

          if self.args.no_history:
              self.cc.no_history = True

      def generate(self):
          """
          @brief Method that works as starting point
          @details
          1. Loads the module defined as Instrument Schedule
          2. Initializes all data
          3. Calls generate_calibrations to produce the daily calibrations
          """

          self.cc.logger.info("Searching for calibration module")
          c = importlib.import_module(self.cc.get("calob:calib_schedule_module"))

          # Find the class which is a subclass of InstrumentCalibrationSchedule
          for k, v in inspect.getmembers(c, predicate=inspect.isclass):
              if issubclass(v, c.InstrumentCalibrationSchedule) and k != "InstrumentCalibrationSchedule":
                  cp = v(self.cc)

          self.cc.logger.info("Initializing Calibration Schedule.")
          if cp:
              cp.init_calibration_schedule()
          else:
              self.cc.logger.error("No Calibration Schedule found")
              raise Exception("No Calibration Schedule found")

          self.cc.logger.info("Generating calibrations")
          cp.generate_calibrations()

CalOb Generator - Execution - Example

In the following an example is shown, which can be executed directly from the shell after the ICS software package have been installed. To do this, carry out the following steps:

1. Ensure “DATAROOT”, “CFGPATH” and “INTROOT” are defined. Example:

$ echo $DATAROOT
/scratch/eltdev/DATAROOT
$ ll /scratch/eltdev/DATAROOT
drwxr-xr-x 2 eltdev vlt 80 May 11 14:48 image/
$ echo $CFGPATH
/scratch/eltdev/INTROOT/resource:/elt/ifw/resource
$ echo $INTROOT
/scratch/eltdev/INTROOT

2. Ensure that the CII Services are up and running: These will normally be started automatically on the ELT development machines.

3. Execute the example CalOb Generator executable “calobGenerator”:

$ calobGenerator -c config/ifw/calob/example/configuration.yaml
$

To execute without the historic feature and showing output in the console:

$ calobGenerator -c config/ifw/calob/example/configuration.yaml -n -x
$

4. Show/explain generated output files: After executation, the output Daily Calibration OB generated can be found in “DATAROOT/calob/daily_calibration/daily_calib.obd.json”, with the example CalOb Configuration File provided.

The Calibration DB file can be found in “$DATAROOT/calob/db/calibration_history.db”. Note, the user shall normally not tamper with this file.

Logs generated during execution are stored in the log file “./ifw-calob.log”, relative to the execution path. Normally the user shall not access this file directly, but shall use the CII Log Service GUI to browse the logs.