Programmatic Usage

You can use Jobman in your own programs.

This kind of usage is useful for things like:

  1. Making custom job submission daemons.
  2. Running Jobman itself in parallel on a cluster.
  3. Integrating Jobman with an external workflow system.

Configuration

Configuration is important for programmatic usage. For example, configuration ensures that every external program that accesses Jobman is using the same databases and directories.

Jobman provides a utility to create a JobMan instance from a config:

The config can be a python module, a dictionary, or a python object. Jobman will try to look up config parameters as dictionary keys or attributes, per jobman.utils.dot_spec_loader.get_attrs_or_items().

Example:

from jobman.jobman import JobMan
my_cfg = {
    'label': 'my_label',
    'db_uri': 'sqlite://',
    'auto_initialize': False,
}
my_jobman = JobMan.from_cfg(
    cfg=my_cfg,
    overrides={'label': 'label_override'}
)
print("label:", my_jobman.label)
print("db_uri:", my_jobman.db_uri)
label: label_override
db_uri: sqlite://

Config parameters are documented in jobman.jobman.CfgParams.

Submitting Jobs

There are two primary ways to submit jobs directly to JobMan:

  1. As job_specs, via jobman.jobman.JobMan.submit_job_spec()
  2. As job dirs, via jobman.jobman.JobMan.submit_job_dir()

Querying Jobs

You may want to query JobMan for the state of a job.

The primary methods for querying are:

  1. jobman.dao.jobs_dao_mixin.JobsDaoMixin.get_job()
  2. jobman.dao.jobs_dao_mixin.JobsDaoMixin.query_jobs()

Updating Jobs

You may want to update jobs in JobMan’s db.

The primary methods for updating are:

  1. jobman.dao.jobs_dao_mixin.JobsDaoMixin.save_jobs()
  2. jobman.dao.jobs_dao_mixin.JobsDaoMixin.update_jobs()