Classes#

EpsicMain#

class dls_bxflow_epsic.epsic_main.EpsicMain(workflow_class)[source]#

Class which will run a workflow from the command line.

The command line arguments will be defined according to the settings defined in the workflow.

The base class, BxWorkflowsMain, takes care of the actual building, scheduling and waiting.

This class defines only the 3 necessary virtual methods required by the base class.

version()[source]#

Method called from mainiac command line parsing. Should return string in form of N.N.N.

about()[source]#

Method called from mainiac command line parsing. Should return dict which can be serialized by json.

get_bx_configurator(presets=None)[source]#

Provide a configurator object.

Typically this will just be the standard object with beamline-specific substitutions defined.

The substitutions are primarily resolved on varibles in the main yaml configuration file, but can be referenced by code as well.

Parameters:

presets (Dict[str, str], Optional) – Dictionary of pre-set environment variables. Defaults to None in which case the system environment variables are used.

Returns:

BxConfigurator object

EpsicWorkflow#

class dls_bxflow_epsic.epsic_workflow.EpsicWorkflow(**kwargs)[source]#

This class provides some beamline-specific helper methods.

It makes some assumptions:
  • tasks are added in order, and only depend on the one coming before to finish

  • the final task ends the job with either of its standard gates

  • any failure gate ends the job

add_notebook_task(notebook_name, modify_cells=None, remex_hints=None, label_suffix=None)[source]#

Add a notebook task.

Parameters:
  • notebook_name (str) – name of the notebook, without root directory or .ipynb suffix

  • modify_cells (Optional[Dict]) – Python code to be put into cells. Defaults to None, which means don’t replace. This argument is a dict whose keys are the cell numbers.

  • remex_hints (Optional[Dict]) – Dictionary specifying the remote execution hints for this task.

  • label_suffix (Optional[str]) – Suffix to be appended to notebook name for task label, for example when multiple of the same task class are done on the same inputs Defaults to None.

Raises:

RuntimeError – Any kind of error in this method.

Returns:

BxTask task object.

add_mib_convert_task(mib_filename)[source]#

Add a mib_convert task.

MibConverter#

class dls_bxflow_epsic.algorithms.mib_converter.MibConverter(mib_filename, bx_task=None)[source]#

Class which converts a single mib file to hdf5. Uses the method “convert” imported from mib2hdfConvert package in ePSIC-DLS/epsic_tools. This class is called from the EpsicWorkflow::add_mib_convert_task method. This runs in the cluster.

async run()[source]#

Run the conversion. Even though async, the caller knows this be long-blocking.

get_interesting_converted_filenames()[source]#

Return list of interesting converted filenames from the conversion.

has_any_converted_filenames()[source]#

Return true if any conversion output filenames are existing.

MibScraper#

class dls_bxflow_epsic.collectors.mib_scraper.MibScraper(specification, predefined_uuid=None)[source]#

Object representing a bx_collector which scrapes disk periodically looking for candidate files. This implementation uses the standard scraper which uses glob. It overrides the making of the data label used in the job.

derive_data_label(data_filename)[source]#

Returns a data label, such as scan number, derived from specification data_filename. This method fulfills the abstract method on the base class.

async trigger_workflow_for_filename(mib_filename)[source]#

Submit workflow for the mib file. This overrides the base class method. Provides data_filename to the workflow constructor. This method fulfills the abstract method on the base class.