seamm_jobserver package#
Submodules#
seamm_jobserver.jobserver module#
The JobServer for the SEAMM environment.
- class seamm_jobserver.jobserver.JobServer(logger=<Logger seamm_jobserver.jobserver (WARNING)>)[source]#
Bases:
MutableMapping- check_for_finished_jobs()[source]#
Check whether jobs have finished.
Both locally-run and SLURM-submitted jobs may be tracked simultaneously now that a single JobServer instance can serve multiple queues of different types (a
type = localsection and one or moretype = slurmsections at once) – so both passes always run, each filteringself._jobsdown to its own mode.
- check_for_new_jobs()[source]#
Check the database for new jobs that are runnable.
If this instance has no configured queues at all (
self._sectionsempty, i.e. no<root>/<jobserver-name>.ini), behavior is exactly what it was before the multi-queue feature existed: every submitted job runs immediately as an uncapped local subprocess, regardless of anyqueuea job’sparametersmight happen to carry. Otherwise, each submitted job is routed to the queue it requested (parameters["queue"]), falling back to this instance’s default queue if it didn’t request one – an unknown or missing-with-no-default queue fails the job immediately rather than silently running it somewhere unintended. Each queue has its ownmax_concurrent_jobs, checked independently, so one full queue never blocks another from accepting new jobs.
- check_for_stopped_jobs()[source]#
Look for jobs that should be actively stopped: either their datastore row vanished entirely (deleted, e.g. via the dashboard), or their status was explicitly set to
kill(stop the run but leave the job’s files/row alone, unlike delete).Before SLURM, a deleted job’s files disappeared but nothing told the local subprocess to stop – it just ran on until it crashed on the missing files. On a scheduler that is not good enough: an orphaned SLURM job can sit running (or queued) for hours. So every poll cycle, before
check_for_finished_jobsgets a chance to treat a just-killed job as merely lost and try to resubmit it, this checks every job actually being tracked and everykill-status row, and issues the realscancel/process-kill.
- property db#
- property db_path#
- start_job(job_id, wdir, cmdline='', queue=None, slurm_overrides=None)[source]#
Run the given job, locally or via SLURM depending on the type of the queue it’s routed to.
- Parameters:
job_id (integer) – The id of the job to run.
queue (str or None) – Which configured section (cluster/queue) to route this job to.
Nonefalls back to this instance’s default queue – see_resolve_queue. If this instance has no queues configured at all, the job always runs as a local subprocess regardless.slurm_overrides (dict or None) – A job’s requested per-directive SLURM overrides (its
parameters["slurm"]), e.g.{"ntasks": 4, "mem": "40G"}. Ignored for a local-mode job. Validated against the queue’slimitsbefore use – seeSlurmSection.merge_overrides.
- Returns:
The local pid, if run locally.
Noneif run via SLURM –_start_job_slurmupdates the datastore itself in that case, since it also needs to record the SLURM job id.- Return type:
int or None
- class seamm_jobserver.jobserver.TkTextHandler(widget)[source]#
Bases:
StreamHandler- emit(record)[source]#
Emit a record.
If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.
Module contents#
seamm_jobserver JobServer for the SEAMM environment.