recipe.handlers package¶
Submodules¶
recipe.handlers.connection module¶
Defines the classes for handling recipe node connections
-
class
recipe.handlers.connection.
DependencyInputConnection
(input_name, node, output_name)¶ Bases:
recipe.handlers.connection.NodeInputConnection
Represents a connection from one node’s output to another node’s input
-
add_input_to_job_data
(job_data, recipe_data, parent_results)¶ See
recipe.handlers.connection.NodeInputConnection.add_input_to_job_data()
-
is_equal_to
(connection, matched_recipe_inputs, matched_job_names)¶ See
recipe.handlers.connection.NodeInputConnection.is_equal_to()
-
-
class
recipe.handlers.connection.
NodeInputConnection
(input_name)¶ Bases:
object
Abstract base class that represents a connection to a recipe node input
-
add_input_to_job_data
(job_data, recipe_data, parent_results)¶ Adds the data for this input to the given job data
Parameters: - job_data (
job.configuration.data.job_data.JobData
) – The job data - recipe_data (
recipe.configuration.data.recipe_data.LegacyRecipeData
orrecipe.seed.recipe_data.RecipeData
) – The recipe data - parent_results ({str:
job.configuration.results.job_results.JobResults
}) – The results of each parent job stored by job name
- job_data (
-
is_equal_to
(connection, matched_recipe_inputs, matched_job_names)¶ Returns true if and only if the given node input connection is equal to this one. This is used for checking the equality of two inputs across two different recipe graphs. Since the different graphs may have different recipe inputs or different job names for the same node, dicts of matched recipe inputs and job names between the graphs are provided.
Parameters: - connection (
recipe.handlers.connection.NodeInputConnection
) – The node input connection - matched_recipe_inputs ({string: string}) – Dict matching recipe input names (connection is the key, self is the value)
- matched_job_names ({string: string}) – Dict matching job names for identical nodes (connection is the key, self is the value)
Returns: True if the connections are equal, False otherwise
Return type: bool
- connection (
-
-
class
recipe.handlers.connection.
RecipeInputConnection
(input_name, recipe_input)¶ Bases:
recipe.handlers.connection.NodeInputConnection
Represents a connection from a recipe’s input to a node’s input
-
add_input_to_job_data
(job_data, recipe_data, parent_results)¶ See
recipe.handlers.connection.NodeInputConnection.add_input_to_job_data()
-
is_equal_to
(connection, matched_recipe_inputs, matched_job_names)¶ See
recipe.handlers.connection.NodeInputConnection.is_equal_to()
-
recipe.handlers.graph module¶
Defines the class for handling recipe graphs
-
class
recipe.handlers.graph.
RecipeGraph
¶ Bases:
object
Represents a graph of recipe nodes
-
add_dependency
(parent_job_name, child_job_name, connections)¶ Adds a dependency that one job has upon another job
Parameters: - parent_job_name (string) – The name of the parent job
- child_job_name (string) – The name of the child job
- connections ([(string, string)]) – List of tuples where first item is parent output name and second item is child input name
-
add_input
(recipe_input)¶ Adds a recipe input to this graph
Parameters: recipe_input ( job.handlers.inputs.base_input.Input
) – The recipe input
-
add_job
(job_name, job_type_name, job_type_version)¶ Adds a new job node to the graph
Parameters: - job_name (string) – The unique name of the job
- job_type_name (string) – The name of the job’s type
- job_type_version (string) – The version of the job’s type
-
add_recipe_input_connection
(recipe_input, job_name, job_input)¶ Adds a recipe input connection from the given recipe input to the given job input
Parameters: - recipe_input (string) – The name of the recipe input
- job_name (string) – The name of the job
- job_input (string) – The name of the job input
-
get_node
(job_name)¶ Returns the node with the given job_name
Parameters: job_name (string) – The job name Returns: The node Return type: recipe.handlers.node.RecipeNode
-
get_topological_order
()¶ Returns the recipe job names in a valid topological ordering (dependency order)
Returns: The list of job names in topological ordering Return type: [string]
-
recipe.handlers.graph_delta module¶
Defines the class for handling recipe graph deltas
-
class
recipe.handlers.graph_delta.
Change
(name, description)¶ Bases:
tuple
-
description
¶ Alias for field number 1
-
name
¶ Alias for field number 0
-
-
class
recipe.handlers.graph_delta.
Reason
(name, description)¶ Bases:
tuple
-
description
¶ Alias for field number 1
-
name
¶ Alias for field number 0
-
-
class
recipe.handlers.graph_delta.
RecipeGraphDelta
(graph_a, graph_b)¶ Bases:
object
Represents the change between two different recipe graphs
-
get_changed_nodes
()¶ Returns the job name mapping between the nodes in graph A and graph B that represent changed nodes that supersede one another
Returns: Dict where the keys are job names from graph B that map to the job names from graph A that they supersede Return type: {string: string}
-
get_deleted_nodes
()¶ Returns the set of job names from graph A that represent job nodes that were deleted in graph B
Returns: The set of job names from graph A that were deleted in graph B Return type: {string}
-
get_identical_nodes
()¶ Returns the job name mapping between the nodes in graph A and graph B that are identical with respect to each other.
Returns: Dict where the keys are job names from graph B that map to the job names from graph A that are identical Return type: {string: string}
-
get_new_nodes
()¶ Returns the set of job names from graph B that represent job nodes that are new (did not exist in graph A)
Returns: The set of job names from graph B that are new Return type: {string}
-
reprocess_identical_node
(job_name)¶ Marks the node with the given job name as changed instead of identical. This can be used to reprocess jobs that have not changed. All children nodes will be changed as well.
Parameters: job_name (string) – The job name of the node
-
recipe.handlers.node module¶
Defines the class for handling recipe nodes
-
class
recipe.handlers.node.
RecipeNode
(job_name, job_type_name, job_type_version)¶ Bases:
object
Represents a node in a recipe
-
add_child
(child_node)¶ Adds a child node that is dependent on this node
Parameters: child_node ( recipe.handlers.node.RecipeNode
) – The child node to add
-
add_dependency
(parent_node, connections)¶ Adds a parent node upon which this node is dependent
Parameters: - parent_node (
recipe.handlers.node.RecipeNode
) – The parent node to add - connections ([
recipe.handlers.connection.DependencyInputConnection
]) – The connections to the parent’s outputs
- parent_node (
-
add_recipe_input
(recipe_input)¶ Adds a recipe input connection to this node
Parameters: recipe_input ( recipe.handlers.connection.RecipeInputConnection
) – The recipe input connection
-
create_job_data
(job_interface, recipe_data, parent_results)¶ Creates the data for the job within this node. The parent_results must contain completed results from every parent node that this node depends upon.
Parameters: - job_interface (
job.configuration.interface.job_interface.JobInterface
orjob.seed.manifest.SeedManifest
) – The job’s interface - recipe_data (
recipe.configuration.data.recipe_data.RecipeData
orrecipe.seed.recipe_data.RecipeData
) – The recipe data - parent_results ({str:
job.configuration.results.job_results.JobResults
}) – The results of each parent job stored by job name
Returns: The created job data
Return type: job.configuration.data.job_data.JobData
orjob.data.job_data.JobData
- job_interface (
-