recipe.configuration.definition package

Submodules

recipe.configuration.definition.exceptions module

Defines exceptions that can occur when interacting with recipe definitions

exception recipe.configuration.definition.exceptions.InvalidDefinition

Bases: exceptions.Exception

Exception indicating that the provided recipe definition was invalid

recipe.configuration.definition.recipe_definition module

Defines the class for managing a recipe definition

class recipe.configuration.definition.recipe_definition.LegacyRecipeDefinition(definition)

Bases: object

Represents the definition for a recipe. The definition includes the recipe inputs, the jobs that make up the recipe, and how the inputs and outputs of those jobs are connected together.

get_dict()

Returns the internal dictionary that represents this recipe definition

Returns:The internal dictionary
Return type:dict
get_graph()

Returns the recipe graph for this definition

Returns:The recipe graph
Return type:recipe.handlers.graph.RecipeGraph
get_job_type_keys()

Returns a set of tuples that represent keys for each job in the recipe

Returns:Set of referenced job types as a tuple of (name, version)
Return type:set[(str, str)]
get_job_type_map()

Returns a mapping of job name to job type for each job in the recipe

Returns:Dictionary with the recipe job name of each job mapping to its job type
Return type:dict of str -> job.models.JobType
get_job_types(lock=False)

Returns a set of job types for each job in the recipe

Parameters:lock (bool) – Whether to obtain select_for_update() locks on the job type models
Returns:Set of referenced job types
Return type:set[job.models.JobType]
get_jobs_to_create()

Returns the list of job names and types to create for the recipe, in the order that they should be created

Returns:List of tuples with each job’s name and type
Return type:[(str, job.models.JobType)]
validate_connection(recipe_conn)

Validates the given recipe connection to ensure that the connection will provide sufficient data to run a recipe with this definition

Parameters:recipe_conn (recipe.configuration.data.recipe_connection.LegacyRecipeConnection) – The recipe definition
Returns:A list of warnings discovered during validation
Return type:list[recipe.configuration.data.recipe_data.ValidationWarning]
:raises recipe.configuration.data.exceptions.InvalidRecipeConnection: If there is a configuration
problem
validate_data(recipe_data)

Validates the given data against the recipe definition

Parameters:recipe_data (recipe.configuration.data.recipe_data.LegacyRecipeData) – The recipe data
Returns:A list of warnings discovered during validation.
Return type:list[recipe.configuration.data.recipe_data.ValidationWarning]

:raises recipe.configuration.data.exceptions.InvalidRecipeData: If there is a configuration problem

validate_job_interfaces()

Validates the interfaces of the recipe jobs in the definition to ensure that all of the input and output connections are valid

Returns:A list of warnings discovered during validation.
Return type:list[job.configuration.data.job_data.ValidationWarning]
:raises recipe.configuration.definition.exceptions.InvalidDefinition:
If there are any invalid job connections in the definition

Module contents