:py:mod:`job.scheduler` ======================= .. py:module:: job.scheduler .. autoapi-nested-parse:: Job scheduler for parallel execution of interdependent jobs. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: job.scheduler.Scheduler Attributes ~~~~~~~~~~ .. autoapisummary:: job.scheduler.JobProviderCallback job.scheduler.logger job.scheduler.DEFAULT_JOB_MAX_DURATION .. py:data:: JobProviderCallback .. py:data:: logger .. py:data:: DEFAULT_JOB_MAX_DURATION .. py:class:: Scheduler(job_provider: JobProviderCallback, collect: CollectCallback | None = None, queues: dict[str, int] | None = None, tokens: int = 1, job_timeout: int = DEFAULT_JOB_MAX_DURATION) Handle parallel execution of interdependent jobs. .. py:property:: is_finished :type: bool Check if all jobs have been executed (internal). :return: True if complete .. py:method:: safe_collect(job: e3.job.Job) -> bool Protect call to collect. This ensures for job such as JobProcess that there are no calls to Run during collect. Main goal is to avoid leak of handles from collect to a process spawned by a Job. On Unixes consequences of such leak is more a security concern than an operational one. On Windows, this can lead easily to file locking issues and thus might cause crashes. :param job: job to collect .. py:method:: safe_job_provider(uid: str, data: Any, predecessors: frozenset[str], notify_end: collections.abc.Callable[[str], None]) -> e3.job.Job Protect call to job_provider. See safe_collect commment above. :param uid: unique job identifier :param data: job data :param predecessors: set of predecessor job IDs :param notify_end: notification function .. py:method:: simple_provider(job_class: type[e3.job.Job]) -> JobProviderCallback :classmethod: Return a simple provider based on a given Job class. :param job_class: a subclass of Job .. py:method:: init_state(dag: e3.collection.dag.DAG) -> None Reinitialize the scheduler state (internal function). :param dag: the dag representing the list of job to execute .. py:method:: log_state() -> None Log the current state of the scheduler (internal). .. py:method:: run(dag: e3.collection.dag.DAG) -> None Launch the scheduler. :param dag: DAG of jobs to execute .. py:method:: push(job: e3.job.Job) -> None Push a job into a queue. :param job: job to push .. py:method:: enqueue() -> None Push into the queues job that are ready (internal). .. py:method:: launch() -> None Launch next jobs in the queues (internal). .. py:method:: wait() -> None Wait for the end of an active job.