recipe.diff package

Submodules

recipe.diff.diff module

Defines the class for representing a diff between two recipe definitions

class recipe.diff.diff.Reason(name, description)

Bases: tuple

description

Alias for field number 1

name

Alias for field number 0

class recipe.diff.diff.RecipeDiff(prev_recipe_definition, recipe_definition)

Bases: object

Represents the diff (difference) betweeen two different recipe definitions

get_nodes_to_copy()

Returns a dict of node diffs for the nodes that should be copied during a reprocess

Returns:Dict of node diffs stored by node name
Return type:dict
get_nodes_to_recursively_supersede()

Returns a dict of node diffs for the sub-recipe nodes that should be completely, recursively superseded as a result of a reprocess

Returns:Dict of node diffs stored by node name
Return type:dict
get_nodes_to_supersede()

Returns a dict of node diffs for the nodes that should be superseded during a reprocess

Returns:Dict of node diffs stored by node name
Return type:dict
get_nodes_to_unpublish()

Returns a dict of node diffs for the nodes that require unpublishing as a result of a reprocess

Returns:Dict of node diffs stored by node name
Return type:dict
set_force_reprocess(forced_nodes)

Provides a set of nodes to force to reprocess

Parameters:forced_nodes (recipe.diff.forced_nodes.ForcedNodes) – Object describing which nodes should be forced to be reprocessed

recipe.diff.exceptions module

Defines exceptions that can occur when interacting with recipe graph diffs

exception recipe.diff.exceptions.InvalidDiff

Bases: exceptions.Exception

Exception indicating that the provided recipe graph diff was invalid

recipe.diff.forced_nodes module

Defines the class for representing nodes within a recipe that are being forced to reprocess

class recipe.diff.forced_nodes.ForcedNodes

Bases: object

Represents nodes within a recipe that are being forced to reprocess

add_node(node_name)

Adds a node to be forced to be reprocessed

Parameters:node_name (string) – The node name
add_subrecipe(node_name, forced_nodes)

Adds a sub-recipe node to be forced to be reprocessed

Parameters:
get_forced_node_names()

Returns the forced node names

Returns:The forced node names
Return type:set
get_forced_nodes_for_subrecipe(node_name)

Returns the ForcedNodes object for the given sub-recipe, possibly None

Parameters:node_name (string) – The node name of the sub-recipe
Returns:The forced nodes for the sub-recipe
Return type:recipe.diff.forced_nodes.ForcedNodes
get_sub_recipe_names()

Returns the sub-recipe node names

Returns:The sub-recipe node names
Return type:set
is_node_forced_to_reprocess(node_name)

Indicates whether the given node is forced to reprocess

Parameters:node_name (string) – The node name
Returns:True if the given node is forced to reprocess, False otherwise
Return type:bool
set_all_nodes()

Sets all nodes to be forced to reprocess

recipe.diff.node module

Defines the class for representing the diff for a node within a recipe definition

class recipe.diff.node.Change(name, description)

Bases: tuple

description

Alias for field number 1

name

Alias for field number 0

class recipe.diff.node.ConditionNodeDiff(condition_node, diff_can_be_reprocessed, status=u'NEW')

Bases: recipe.diff.node.NodeDiff

Represents a diff for a condition node within a recipe definition

get_node_type_dict()

See recipe.diff.node.NodeDiff.get_node_type_dict()

class recipe.diff.node.JobNodeDiff(job_node, diff_can_be_reprocessed, status=u'NEW')

Bases: recipe.diff.node.NodeDiff

Represents a diff for a job node within a recipe definition

get_node_type_dict()

See recipe.diff.node.NodeDiff.get_node_type_dict()

class recipe.diff.node.NodeDiff(node, diff_can_be_reprocessed, status=u'NEW')

Bases: object

Represents a diff for a node within a recipe definition

CHANGED = u'CHANGED'
DELETED = u'DELETED'
NEW = u'NEW'
STATUSES_REPROCESS_NEW_NODE = [u'CHANGED', u'NEW']
UNCHANGED = u'UNCHANGED'
add_dependency(node_diff, acceptance=True)

Adds a dependency that this node diff has on the given node diff

Parameters:
  • node_diff (recipe.diff.node.NodeDiff) – The dependency node diff to add
  • acceptance (bool) – Whether this node should run when the parent is accepted or when it is not accepted
compare_to_previous(prev_node)

Compares this node to the given node from the previous revision and calculates the diff between the nodes

Parameters:prev_node (recipe.definition.node.NodeDefinition) – The node from the previous revision
get_node_type_dict()

Returns a JSON dict describing the node type details for this node diff

Returns:The JSON dict describing the node type details
Return type:dict
set_force_reprocess(forced_nodes)

Sets this node to force to reprocess. The given object recursively describes which nodes should be forced to reprocess in sub-recipes.

Parameters:forced_nodes (recipe.diff.forced_nodes.ForcedNodes) – Object describing which nodes should be forced to be reprocessed
should_be_copied()

Indicates whether this node should be copied from the previous recipe during a reprocess

Returns:Whether this node should be copied
Return type:bool
should_be_recursively_superseded()

Indicates whether this node should be completely, recursively superseded in the previous recipe during a reprocess

Returns:Whether this node should be completely, recursively superseded
Return type:bool
should_be_superseded()

Indicates whether this node should be superseded in the previous recipe during a reprocess

Returns:Whether this node should be superseded
Return type:bool
should_be_unpublished()

Indicates whether this node requires unpublishing as a result of a reprocess

Returns:Whether this node should be unpublished
Return type:bool
class recipe.diff.node.RecipeNodeDiff(recipe_node, diff_can_be_reprocessed, status=u'NEW')

Bases: recipe.diff.node.NodeDiff

Represents a diff for a recipe node within a recipe definition

get_node_type_dict()

See recipe.diff.node.NodeDiff.get_node_type_dict()

set_force_reprocess(forced_nodes)

See recipe.diff.node.NodeDiff.set_force_reprocess()

should_be_recursively_superseded()

See recipe.diff.node.NodeDiff.should_be_recursively_superseded()

recipe.diff.node.create_diff_for_node(node, diff_can_be_reprocessed, status)

Creates a node diff for the given node

Parameters:
Returns:

The node diff

Return type:

recipe.diff.node.NodeDiff

Module contents