upsies.jobs.jobrunner
Manage a bunch of jobs
Classes
- class upsies.jobs.jobrunner.JobRunner(jobs=(), id='anonymous')[source]
Bases:
MappingWrapper around a bunch of
JobBasesubclasses to manage them collectivelyThis class subclasses
Mappingfor easy access to jobs. Keys are jobnames and values are theJobBaseinstances.- Parameters:
jobs –
collections.abc.IterableofJobBasesubclassesid (str) – Any identifier (only used for debugging)
- add(*jobs)[source]
Add jobs
Every job must have a unique
name.- Parameters:
jobs –
JobBasesubclasses
- property enabled_jobs
Same as
all_jobs, but without any jobs that are notis_enabled
- start_more_jobs()[source]
start()all jobs that are ready to startJobs that have
autostartunset are not started.Jobs may also not be started if they are
disabledor otherwise unstartable. Seestart().Note
This method must be called while an asyncio event loop is running because JobBase.start() calls JobBase.add_task(), and a task must be added to a loop to run.
- async wait()[source]
Wait for all jobs that are started and not finished
Note
This does not raise exceptions from jobs. See
exceptionsafter calling this method.
- property all_jobs_finished
Whether all
enabled_jobsare finished