plainbox.impl.job – job definition

Warning

THIS MODULE DOES NOT HAVE STABLE PUBLIC API

class plainbox.impl.job.CheckBoxJobValidator[source]

Validator for CheckBox jobs.

static validate(job)[source]

Validate the specified job

class plainbox.impl.job.JobDefinition(data, origin=None, provider=None, controller=None, raw_data=None)[source]

Job definition class.

Thin wrapper around the RFC822 record that defines a checkbox job definition

automated[source]

Whether the job is fully automated and runs without any intervention from the user

controller[source]

The controller object associated with this JobDefinition

create_child_job_from_record(record)[source]

Create a new JobDefinition from RFC822 record.

This method should only be used to create additional jobs from local jobs (plugin local). This ensures that the child job shares the embedded provider reference.

depends[source]
description[source]
estimated_duration[source]

estimated duration of this job in seconds.

The value may be None, which indicates that the duration is basically unknown. Fractional numbers are allowed and indicate fractions of a second.

class fields[source]

Symbols for each field that a JobDefinition can have

command = Symbol('command')
depends = Symbol('depends')
description = Symbol('description')
environ = Symbol('environ')
estimated_duration = Symbol('estimated_duration')
classmethod get_all_symbols()

Get all symbols defined by this symbol definition block

id = Symbol('id')
name = Symbol('name')
plugin = Symbol('plugin')
requires = Symbol('requires')
summary = Symbol('summary')
user = Symbol('user')
classmethod JobDefinition.from_rfc822_record(record)[source]

Create a JobDefinition instance from rfc822 record

The record must be a RFC822Record instance.

Only the ‘id’ and ‘plugin’ keys are required. All other data is stored as is and is entirely optional.

JobDefinition.get_direct_dependencies()[source]

Compute and return a set of direct dependencies

To combat a simple mistake where the jobs are space-delimited any mixture of white-space (including newlines) and commas are allowed.

JobDefinition.get_normalized_translated_data(msgid)[source]

Get a localized piece of data and filter it with RFC822 parser normalization

Parameters:msgid – data to translate
Returns:translated and normalized data obtained from the provider if this job has one, msgid itself otherwise.
JobDefinition.get_resource_dependencies()[source]

Compute and return a set of resource dependencies

JobDefinition.get_resource_program()[source]

Return a ResourceProgram based on the ‘requires’ expression.

The program instance is cached in the JobDefinition and is not compiled or validated on subsequent calls.

Returns ResourceProgram or None Raises ResourceProgramError or SyntaxError

JobDefinition.get_translated_data(msgid)[source]

Get a localized piece of data

Parameters:msgid – data to translate
Returns:translated data obtained from the provider if this job has one, msgid itself otherwise.
JobDefinition.id[source]
JobDefinition.name[source]
JobDefinition.origin[source]

The Origin object associated with this JobDefinition

JobDefinition.partial_id[source]

Identifier of this job, without the provider name

This field should not be used anymore, except for display

JobDefinition.plugin[source]
JobDefinition.provider[source]

The provider object associated with this JobDefinition

JobDefinition.requires[source]
JobDefinition.startup_user_interaction_required[source]

The job needs to be started explicitly by the test operator. This is intended for things that may be timing-sensitive or may require the tester to understand the necessary manipulations that he or she may have to perform ahead of time.

The test operator may select to skip certain tests, in that case the outcome is skip.

JobDefinition.summary[source]
JobDefinition.tr_description()[source]

Get the translated version of description()

JobDefinition.tr_summary()[source]

Get the translated version of summary()

JobDefinition.update_origin(origin)[source]

Change the Origin object associated with this JobDefinition

Note

This method is a unfortunate side effect of how via and local jobs that cat existing jobs are implemented. Ideally jobs would be trully immutable. Do not use this method lightly.

JobDefinition.validate(validator_cls=<class 'plainbox.impl.job.CheckBoxJobValidator'>)[source]

Validate this job definition with the specified validator

Raises ValidationError:
 If the job has any problems that make it unsuitable for execution.
JobDefinition.via[source]

The checksum of the “parent” job when the current JobDefinition comes from a job output using the local plugin

class plainbox.impl.job.JobOutputTextSource(job)[source]

A ITextSource subclass indicating that text came from job output.

This class is used by SessionState._gen_rfc822_records_from_io_log() to allow such (generated) jobs to be traced back to the job that generated them.

Variables:jobplainbox.impl.job.JobDefinition instance that generated the text
class plainbox.impl.job.JobTreeNode(name=None)[source]

JobTreeNode class is used to store a tree structure. A tree consists of a collection of JobTreeNode instances connected in a hierarchical way where nodes are used as categories, jobs belonging to a category are listed in the node leaves.

Example:

      / Job A
Root-|
     |                 / Job B
      \--- Category X |
                       \ Job C
add_category(category)[source]

Adds a new category to this node.

Parameters:category – the node instance to be added as a category.
add_job(job)[source]

Adds a new job to this node.

Parameters:job – the job instance to be added to this node.
categories[source]

list of sub categories

classmethod create_tree(job_list, node=None, link=None, legacy_mode=False)[source]

Build a rooted JobTreeNode from a job list

Parameters:
  • job_list – List of jobs to consider for building the tree.
  • node (None) – Parent node to start with.
  • link (None) – Parent-child link used to create the descendants.
  • legacy_mode (False) – Whether local jobs are used to build the tree or a new experimental job metadata (categories).
depth[source]

level of depth for this node

get_ancestors()[source]

Returns the list of all ancestor nodes from current node to the current tree root.

get_descendants()[source]

Returns a list of all descendant category nodes.

jobs[source]

job(s) belonging to this node/category

name[source]

node name

parent[source]

parent node for this node

class plainbox.impl.job.Problem[source]

Symbols for each possible problem that a field value may have

classmethod get_all_symbols()

Get all symbols defined by this symbol definition block

missing = Symbol('missing')
useless = Symbol('useless')
wrong = Symbol('wrong')
exception plainbox.impl.job.ValidationError(field, problem)[source]

Exception raised by to report jobs with problematic definitions.

class plainbox.impl.job.propertywithsymbols(fget=None, fset=None, fdel=None, doc=None, symbols=None)[source]

A property that also keeps a group of symbols around

Previous topic

plainbox.impl.integration_tests – integration tests

Next topic

plainbox.impl.logging – configuration for logging

This Page