platforms class#

class pycif.utils.classes.platforms.Platform(**kwargs)[source]#

Bases: Plugin

Plugin type for HPC job submission platforms.

Handles job submission and status checking for platforms such as SLURM, PBS or a local interactive shell. Concrete plugins override submit_job() and check_jobs().

Concrete implementations live in pycif/plugins/platforms/.

initiate_template()[source]#

Initialise the Platform plugin template.

Loads the registered platform module and attaches submit_job and check_jobs as bound methods on this instance.

classmethod register_plugin(name, version, module, subtype='', **kwargs)[source]#

Register a module for a plugin and version with possibly options

Parameters:
  • name (str) – name of the plugin

  • version (str) – version of the plugin

  • module (types.ModuleType) – module defining the interface between pyCIF and the plugin

  • plugin_type (str) – type of plugin

  • **kwargs (dictionary) – default options for module

submit_job(exe, job_file)[source]#

Submit a job script to the platform.

Default implementation runs exe as a subprocess in the directory containing job_file and waits for it to complete.

Parameters:
  • exe (str) – Command (and arguments) to execute.

  • job_file (str) – Path to the job script; its parent directory is used as the working directory.

check_jobs(list_jobs)[source]#

Check whether a list of submitted jobs have completed.

Default implementation always returns True (assumes synchronous execution where jobs complete before this method is called).

Parameters:

list_jobs (list) – List of job identifiers to check.

Returns:

True if all jobs are finished.

Return type:

bool