recipe.messages package

Submodules

recipe.messages.create_conditions module

Defines a command message that creates condition models

class recipe.messages.create_conditions.Condition(node_name, process_input)

Bases: tuple

node_name

Alias for field number 0

process_input

Alias for field number 1

class recipe.messages.create_conditions.CreateConditions

Bases: messaging.messages.message.CommandMessage

Command message that creates condition models

add_recipe_condition(recipe_condition)

Adds the given recipe condition to this message to be created

Parameters:recipe_condition (recipe.messages.create_conditions.Condition) – The recipe condition
can_fit_more()

Indicates whether more conditions can fit in this message

Returns:True if more conditions can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.create_conditions.create_conditions_messages(recipe, conditions)

Creates messages to create conditions with a recipe

Parameters:
  • recipe (recipe.models.Recipe) – The recipe model
  • conditions (list()) – The list of Condition tuples describing the conditions to create
Returns:

The list of messages

Return type:

list()

recipe.messages.create_recipes module

Defines a command message that creates recipe models

class recipe.messages.create_recipes.CreateRecipes

Bases: messaging.messages.message.CommandMessage

Command message that creates recipe models

add_recipe_to_reprocess(root_recipe_id)

Adds the given root recipe ID to this message to be reprocessed

Parameters:root_recipe_id (int) – The root recipe ID
add_subrecipe(sub_recipe)

Adds the given sub-recipe to this message to be created

Parameters:sub_recipe (recipe.messages.create_recipes.SubRecipe) – The sub-recipe
can_fit_more()

Indicates whether more recipes can fit in this message

Returns:True if more recipes can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

class recipe.messages.create_recipes.SubRecipe(recipe_type_name, recipe_type_rev_num, node_name, process_input)

Bases: tuple

node_name

Alias for field number 2

process_input

Alias for field number 3

recipe_type_name

Alias for field number 0

recipe_type_rev_num

Alias for field number 1

recipe.messages.create_recipes.create_batch_recipes_messages(recipe_type_name, revision_num, recipe_data, event_id, batch_id=None)

Creates messages to create the recipe

Parameters:
  • recipe_type_name (string) – The new recipe type name
  • revision_num (int) – The revision number of the recipe type
  • recipe_data (list()) – The input data for the recipe
  • event_id (int) – The event ID
  • batch_id – The batch ID
Type:

batch_id: int

Returns:

The list of messages

Return type:

list()

recipe.messages.create_recipes.create_recipes_messages(recipe_type_name, revision_num, recipe_data, event_id, ingest_event_id, configuration=None, batch_id=None)

Creates messages to create the recipe

Parameters:
  • recipe_type_name (string) – The new recipe type name
  • revision_num (int) – The revision number of the recipe type
  • recipe_data (dict) – The input data for the recipe
  • event_id (int) – The event ID
  • ingest_event_id (int) – The ingest event id
  • configuration (dict) – The configuration of the recipe
  • batch_id – The batch ID
Type:

batch_id: int

Returns:

The list of messages

Return type:

list()

recipe.messages.create_recipes.create_reprocess_messages(root_recipe_ids, recipe_type_name, revision_num, event_id, batch_id=None, forced_nodes=None)

Creates messages to reprocess the given recipes

Parameters:
  • root_recipe_ids (list()) – The root recipe IDs
  • recipe_type_name (string) – The new recipe type name
  • revision_num (int) – The new recipe type revision number
  • event_id (int) – The event ID
  • batch_id (int) – The batch ID
  • forced_nodes (recipe.diff.forced_nodes.ForcedNodes) – Describes the nodes that have been forced to reprocess
Returns:

The list of messages

Return type:

list()

recipe.messages.create_recipes.create_subrecipes_messages(recipe, sub_recipes, forced_nodes=None)

Creates messages to create sub-recipes for the given recipe

Parameters:
Returns:

The list of messages

Return type:

list()

recipe.messages.process_condition module

Defines a command message that processes a recipe condition

class recipe.messages.process_condition.ProcessCondition

Bases: messaging.messages.message.CommandMessage

Command message that processes a recipe condition

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.process_condition.create_process_condition_messages(condition_ids)

Creates messages to process the given conditions

Parameters:condition_ids (list()) – The condition IDs
Returns:The list of messages
Return type:list()

recipe.messages.process_recipe_input module

Defines a command message that processes the input for a recipe

class recipe.messages.process_recipe_input.ProcessRecipeInput

Bases: messaging.messages.message.CommandMessage

Command message that processes the input for a recipes

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.process_recipe_input.create_process_recipe_input_messages(recipe_ids, forced_nodes=None)

Creates messages to process the input for the given recipes

Parameters:
Returns:

The list of messages

Return type:

list()

recipe.messages.purge_recipe module

Defines a command message that purges a recipe

class recipe.messages.purge_recipe.PurgeRecipe

Bases: messaging.messages.message.CommandMessage

Command message that purges recipe components

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.purge_recipe.create_purge_recipe_message(recipe_id, trigger_id, source_file_id)

Creates messages to remove the given recipe by ID

Parameters:
  • recipe_id – The recipe ID
  • trigger_id (int) – The trigger event ID for the purge operation
  • source_file_id (int) – The source file id for the original file being purged
Returns:

The purge recipe message

Return type:

recipe.messages.purge_recipe.PurgeRecipe

recipe.messages.supersede_recipe_nodes module

Defines a command message that supersedes recipe nodes

class recipe.messages.supersede_recipe_nodes.SupersedeRecipeNodes

Bases: messaging.messages.message.CommandMessage

Command message that supersedes recipe nodes

add_recipe(recipe_id)

Adds the given recipe ID to this message

Parameters:recipe_id (int) – The recipe ID
can_fit_more()

Indicates whether more recipes can fit in this message

Returns:True if more recipes can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.supersede_recipe_nodes.create_supersede_recipe_nodes_messages(recipe_ids, when, supersede_jobs, supersede_subrecipes, unpublish_jobs, supersede_recursive, unpublish_recursive)

Creates messages to supersede nodes in the given recipes

Parameters:
  • recipe_ids (list()) – The recipe IDs
  • when (datetime.datetime) – When the jobs/sub-recipes were superseded
  • supersede_jobs (set) – The node names for jobs to supersede
  • supersede_subrecipes (set) – The node names for sub-recipes to supersede
  • unpublish_jobs (set) – The node names for jobs to unpublish
  • supersede_recursive (set) – The node names for sub-recipes that should recursively supersede all of their nodes
  • unpublish_recursive (set) – The node names for sub-recipes that should recursively supersede/unpublish all of their nodes
Returns:

The list of messages

Return type:

list()

recipe.messages.update_recipe module

Defines a command message that evaluates and updates a recipe

class recipe.messages.update_recipe.UpdateRecipe

Bases: messaging.messages.message.CommandMessage

Command message that evaluates and updates a recipe

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.update_recipe.create_update_recipe_message(root_recipe_id, forced_nodes=None)

Creates a message to update the given recipe from its root ID

Parameters:
Returns:

The message

Return type:

recipe.messages.update_recipe.UpdateRecipe

recipe.messages.update_recipe.create_update_recipe_messages_from_node(root_recipe_ids)

Creates messages to update the given recipes from the root IDs. This is intended to be used by recipe nodes that have been updated and need to then update the recipes that contain the nodes.

Parameters:root_recipe_ids (list()) – The root recipe IDs
Returns:The list of messages
Return type:list()

recipe.messages.update_recipe_definition module

Defines a command message that evaluates and updates a recipe

class recipe.messages.update_recipe_definition.UpdateRecipeDefinition

Bases: messaging.messages.message.CommandMessage

Command message that evaluates and updates a recipe

execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.update_recipe_definition.create_activate_recipe_message(recipe_type_id, is_active)

Creates a message to activate/deactivate a recipe type and any parent recipe types

Parameters:
  • recipe_type_id (int) – The recipe type to update
  • is_active (bool) – Whether the recipe type is active or inactive
Returns:

The message

Return type:

recipe.messages.update_recipe.UpdateRecipeDefinition

recipe.messages.update_recipe_definition.create_job_update_recipe_definition_message(recipe_type_id, job_type_id)

Creates a message to update the given recipe type to use the latest revision of the job type

Parameters:
  • recipe_type_id (int) – The recipe type to update
  • job_type_id (int) – The job type
Returns:

The list of messages

Return type:

list()

recipe.messages.update_recipe_definition.create_sub_update_recipe_definition_message(recipe_type_id, sub_recipe_type_id)

Creates a message to update the given recipe type to use the latest revision of the sub recipe type

Parameters:
  • recipe_type_id (int) – The recipe type to update
  • sub_recipe_type_id (int) – The sub recipe type
Returns:

The message

Return type:

recipe.messages.update_recipe.UpdateRecipeDefinition

recipe.messages.update_recipe_metrics module

Defines a command message that updates recipe metrics

class recipe.messages.update_recipe_metrics.UpdateRecipeMetrics

Bases: messaging.messages.message.CommandMessage

Command message that updates recipe metrics

add_recipe(recipe_id)

Adds the given recipe ID to this message

Parameters:recipe_id (int) – The recipe ID
can_fit_more()

Indicates whether more recipes can fit in this message

Returns:True if more recipes can fit, False otherwise
Return type:bool
execute()

See messaging.messages.message.CommandMessage.execute()

static from_json(json_dict)

See messaging.messages.message.CommandMessage.from_json()

to_json()

See messaging.messages.message.CommandMessage.to_json()

recipe.messages.update_recipe_metrics.create_update_recipe_metrics_messages(recipe_ids)

Creates messages to update the metrics for the given recipes

Parameters:recipe_ids (list()) – The recipe IDs
Returns:The list of messages
Return type:list()
recipe.messages.update_recipe_metrics.create_update_recipe_metrics_messages_from_jobs(job_ids)

Creates messages to update the metrics for the recipes affected by the given jobs

Parameters:job_ids (list()) – The job IDs
Returns:The list of messages
Return type:list()
recipe.messages.update_recipe_metrics.create_update_recipe_metrics_messages_from_sub_recipes(sub_recipe_ids)

Creates messages to update the metrics for the recipes affected by the given sub-recipes

Parameters:sub_recipe_ids (list()) – The sub-recipe IDs
Returns:The list of messages
Return type:list()

Module contents