recipe.instance package

Submodules

recipe.instance.exceptions module

Defines exceptions that can occur when interacting with recipe instances

exception recipe.instance.exceptions.InvalidRecipe

Bases: exceptions.Exception

Exception indicating that the provided recipe instance was invalid

recipe.instance.node module

Defines the classes for representing nodes within a recipe

class recipe.instance.node.ConditionNodeInstance(definition, condition, is_original)

Bases: recipe.instance.node.NodeInstance

Represents a condition within a recipe

is_accepted()

Indicates whether this node is accepted. Used for evaluating condition nodes

Returns:True if the condition for this node is accepted, false otherwise.
Return type:bool
is_completed()

See recipe.instance.node.NodeInstance.is_completed()

is_ready_for_children()

See recipe.instance.node.NodeInstance.is_ready_for_children()

needs_to_be_created()

See recipe.instance.node.NodeInstance.needs_to_be_created()

needs_to_process_input()

See recipe.instance.node.NodeInstance.needs_to_process_input()

class recipe.instance.node.DummyNodeInstance(definition)

Bases: recipe.instance.node.NodeInstance

Represents a placeholder node that stands in for a node that doesn’t exist in this recipe instance

is_completed()

See recipe.instance.node.NodeInstance.is_completed()

is_ready_for_children()

See recipe.instance.node.NodeInstance.is_ready_for_children()

needs_to_be_created()

See recipe.instance.node.NodeInstance.needs_to_be_created()

class recipe.instance.node.JobNodeInstance(definition, job, is_original)

Bases: recipe.instance.node.NodeInstance

Represents a job within a recipe

get_jobs_to_update(pending_job_ids, blocked_job_ids)

See recipe.instance.node.NodeInstance.get_jobs_to_update()

is_completed()

See recipe.instance.node.NodeInstance.is_completed()

needs_to_process_input()

See recipe.instance.node.NodeInstance.needs_to_process_input()

class recipe.instance.node.NodeInstance(definition, is_original)

Bases: object

Represents a node within a recipe

add_dependency(node, acceptance=True)

Adds a dependency that this node has on the given node

Parameters:
  • node (recipe.instance.node.NodeInstance) – The dependency node to add
  • acceptance (bool) – Whether this node should run when the parent is accepted or when it is not accepted
get_jobs_to_update(pending_job_ids, blocked_job_ids)

Adds a job ID to one of the given lists if it needs to be updated to PENDING or BLOCKED status

Parameters:
  • pending_job_ids (list()) – The list of IDs for jobs that should be set to PENDING
  • blocked_job_ids (list()) – The list of IDs for jobs that should be set to BLOCKED
is_accepted()

Indicates whether this node is accepted. Used for evaluating condition nodes

Returns:True if this node is accepted, false otherwise. Will always return true except for condition nodes
Return type:bool
is_completed()

Indicates whether this node has completed

Returns:True if this node has completed, False otherwise
Return type:bool
is_ready_for_children()

Indicates whether this node is ready for its children to process

Returns:True if this node is ready for its children to process, False otherwise
Return type:bool
needs_to_be_created()

Indicates whether this node needs to be created

Returns:True if this node needs to be created, False otherwise
Return type:bool
needs_to_process_input()

Indicates whether this node needs to process its input

Returns:True if this node needs to process its input, False otherwise
Return type:bool
class recipe.instance.node.RecipeNodeInstance(definition, recipe, is_original)

Bases: recipe.instance.node.NodeInstance

Represents a recipe within a recipe

get_jobs_to_update(pending_job_ids, blocked_job_ids)

See recipe.instance.node.NodeInstance.get_jobs_to_update()

is_completed()

See recipe.instance.node.NodeInstance.is_completed()

needs_to_process_input()

See recipe.instance.node.NodeInstance.needs_to_process_input()

recipe.instance.recipe module

Defines the class for representing an instance of an executing recipe

class recipe.instance.recipe.RecipeInstance(definition, recipe_model, recipe_nodes)

Bases: object

Represents an executing recipe

get_jobs_to_update()

Returns the jobs within this recipe that should be updated to a new status (either BLOCKED or PENDING)

Returns:A dict with status (PENDING or BLOCKED) mapping to lists of job IDs
Return type:dict
get_nodes_to_create()

Returns the node definitions within this recipe for nodes that should be created

Returns:A dict where node names map to node definitions
Return type:dict
get_nodes_to_process_input()

Returns the node instances within this recipe for nodes that need to process their input

Returns:A dict where node names map to node instances
Return type:dict
get_original_leaf_nodes()

Returns a mapping of original leaf nodes with the recipe

Returns:A dict with node name mapping to original leaf nodes
Return type:dict
has_completed()

Indicates whether this recipe has completed

Returns:True if this recipe has completed, False otherwise
Return type:bool

Module contents