jobman package¶
Subpackages¶
Submodules¶
jobman.constants module¶
jobman.jobman module¶
-
class
jobman.jobman.
CfgParams
[source]¶ Bases:
object
JobMan Config Parameters
-
auto_initialize
= True¶ If True then create jobman db and initialize sources/engines.
-
dao
= Ellipsis¶ An instance of a JobManDAO. Usually only used for testing.
-
db_uri
= Ellipsis¶ A database uri.
Currently can only use Sqlite uris. For example, ‘sqlite://’ for an in-memory db, or ‘sqlite:////absolute/path/to/db.sqlite’ for a file-based db.
-
debug
= Ellipsis¶ set to True to operate in debug mode. Logs more verbose statements.
-
label
= Ellipsis¶ A label to identify this jobman instance. Useful for logging.
-
logging_cfg
= Ellipsis¶ logging config, per
jobman.utils.logging_utils.generate_logger()
-
source_specs
= Ellipsis¶ A dict of keyed source specs.
A source spec is a dict with this shape:
{ # a dot_spec path to a source class 'source_class': 'jobman.sources.dir_source:DirSource' # a dict of params to pass as kwargs when instantiating the # source. 'source_params': { 'root_path': self.root_path } }
-
worker_specs
= Ellipsis¶ A dict of keyed worker specs.
A worker spec is a dict with this shape:
{ # a dot_spec path to a worker class 'worker_class': 'jobman.workers.base_worker:BaseWorker' # a dict of params to pass as kwargs when instantiating the # worker. 'worker_params': { # a spec for the worker's engine. 'engine_spec': { 'engine_class': ( 'jobman.engines.local_engine:LocalEngine' ), 'engine_params': { 'scratch_dir': self.scratch_dir, # This is usually where engine configs go. 'cfg': { 'MY_EXE': '/my/cluster/path/to/my_exe', # other cluster-specific params... } } }, # other worker params... } }
-
-
class
jobman.jobman.
JobMan
(label=None, cfg=None, source_specs=None, job_spec_defaults=None, worker_specs=None, dao=None, db_uri=None, auto_initialize=True, logging_cfg=None, debug=None)[source]¶ Bases:
object
Central JobMan object.
Parameters: - label – per
CfgParams.label
. - cfg – cfg object or dict.
- source_specs – per
CfgParams.source_specs
. - job_spec_defaults – per
job_spec_defaults
. - worker_specs – per
CfgParams.worker_specs
. - dao – per
CfgParams.dao
. - db_uri – per
CfgParams.db_uri
. - auto_initialize – per
CfgParams.auto_initialize
. - logging_cfg – per
CfgParams.logging_cfg
. - debug – per
CfgParams.debug
.
-
class
JOB_STATUSES
¶ Bases:
object
-
CLAIMED
= 'CLAIMED'¶
-
COMPLETED
= 'COMPLETED'¶
-
EXECUTED
= 'EXECUTED'¶
-
FAILED
= 'FAILED'¶
-
PENDING
= 'PENDING'¶
-
RUNNING
= 'RUNNING'¶
-
UNKNOWN
= 'UNKNOWN'¶
-
-
classmethod
from_cfg
(cfg=None, overrides=None)[source]¶ Create a JobMan instance from a cfg.
Parameters: - cfg – can be an object or dict. Keys or attrs per
CfgParams
. - overrides – dict of cfg overrides
Returns: JobMan instance
- cfg – can be an object or dict. Keys or attrs per
-
job_spec_defaults
= {'entrypoint': './entrypoint.sh'}¶ Default job_spec values.
-
submit_job_dir
(job_dir=None, source_key=None, source_meta=None, job_spec_defaults=None, job_spec_overrides=None)[source]¶ Submit a job dir.
Creates a job_spec for dir. Attempts to read job_spec file from dir if provided.
Parameters: - job_dir – absolute path to job_dir
- source_key – per
jobman.dao.jobman_sqlite_dao.JobmanSqliteDAO.JobSchema.source_key
- source_meta – per
jobman.dao.jobman_sqlite_dao.JobmanSqliteDAO.JobSchema.source_meta
- job_spec_defaults – default values for job_spec that will be generated for dir.
- job_spec_overrides – job_spec value overrides. Will be set after any job_spec values are read from job_dir.
Returns: return per
submit_job_spec()
.
-
submit_job_spec
(job_spec=None, source_key=None, source_meta=None)[source]¶ Submit a job spec.
Parameters: - job_spec – per
jobman.dao.jobman_sqlite_dao.JobmanSqliteDAO.JobSchema.job_spec
- source_key – per
jobman.dao.jobman_sqlite_dao.JobmanSqliteDAO.JobSchema.source_key
- source_meta – per
jobman.dao.jobman_sqlite_dao.JobmanSqliteDAO.JobSchema.source_meta
Returns: - return job record per
- job_spec – per
- label – per