plainbox.impl.depmgr – dependency solver

Warning

THIS MODULE DOES NOT HAVE STABLE PUBLIC API

exception plainbox.impl.depmgr.DependencyCycleError(job_list)[source]

Exception raised when a cyclic dependency is detected

affected_job[source]

the job that has a cyclic dependency on itself

affecting_job[source]

same as affected_job

exception plainbox.impl.depmgr.DependencyDuplicateError(job, duplicate_job)[source]

Exception raised when two jobs have identical name

affected_job[source]

the job that already known by the system

affecting_job[source]

the job that is clashing with the job already in the system

exception plainbox.impl.depmgr.DependencyError[source]

Exception raised when a dependency error is detected

affected_job[source]

JobDefinition instance that is affected by the dependency error.

affecting_job[source]

JobDefinition instance that is affecting affected_job

This may be None in certain cases (eg, when the job does not exist and is merely referred to by name). If this job exists removing it SHOULD fix this problem from occurring.

This may be the same as affected_job

exception plainbox.impl.depmgr.DependencyMissingError(job, missing_job_name, dep_type)[source]

Exception raised when a job has an unsatisfied dependency

DEP_TYPE_DIRECT = 'direct'
DEP_TYPE_RESOURCE = 'resource'
affected_job[source]

the job that has a missing dependency

affecting_job[source]

the job that is affecting affected_job

This is always None as we have not seen this job at all and that’s what’s causing the problem in the first place.

class plainbox.impl.depmgr.DependencySolver(job_list)[source]

Dependency solver for Jobs

Uses a simple depth-first search to discover the sequence of jobs that can run. Use the resolve_dependencies() class method to get the solution.

COLOR_BLACK = 2
COLOR_GRAY = 1
COLOR_WHITE = 0
classmethod resolve_dependencies(job_list, visit_list=None)[source]

Solve the dependency graph expressed as a list of job definitions.

Parameters:
  • job_list (list) – list of known jobs
  • visit_list (list) – (optional) list of jobs to solve

The visit_list, if specified, allows to consider only a part of the graph while still having access and knowledge of all jobs.

Returns list:

the solution (a list of jobs to execute in order)

Raises:
  • DependencyDuplicateError – if a duplicate job definition is present
  • DependencyCycleError – if a cyclic dependency is present.
  • DependencyMissingErorr – if a required job does not exist.

Previous topic

plainbox.impl.ctrl – Controller Classes

Next topic

plainbox.impl.exporter – shared code for session state exporters

This Page