recipe.configuration.data package¶
Submodules¶
recipe.configuration.data.exceptions module¶
Defines exceptions that can occur when interacting with recipe data
-
exception
recipe.configuration.data.exceptions.
InvalidRecipeConnection
¶ Bases:
exceptions.Exception
Exception indicating that the provided recipe connection was invalid
-
exception
recipe.configuration.data.exceptions.
InvalidRecipeData
¶ Bases:
exceptions.Exception
Exception indicating that the provided recipe data was invalid
recipe.configuration.data.recipe_connection module¶
Defines connections that will provide data to execute recipes
-
class
recipe.configuration.data.recipe_connection.
LegacyRecipeConnection
¶ Bases:
object
Represents a connection that will provide data to execute recipes. This class contains the necessary description needed to ensure the data provided by the connection will be sufficient to execute the given recipe.
-
add_input_file
(file_name, multiple, media_types, optional)¶ Adds a new file parameter to this connection
Parameters: - file_name (str) – The file parameter name
- multiple (bool) – Whether the file parameter provides multiple files (True)
- media_types (list of str) – The possible media types of the file parameter (unknown if None or [])
- optional (bool) – Whether the file parameter is optional and may not be provided (True)
-
add_property
(property_name)¶ Adds a new property parameter to this connection
Parameters: property_name (str) – The property parameter name
-
add_workspace
()¶ Indicates that this connection provides a workspace for storing output files
-
has_workspace
()¶ Indicates whether this connection provides a workspace for storing output files
Returns: True if this connection provides a workspace, False otherwise Return type: bool
-
validate_input_files
(files)¶ Validates the given file parameters to make sure they are valid with respect to the recipe definition.
Parameters: files (dict of str -> tuple(bool, bool, job.configuration.interface.scale_file.ScaleFileDescription
)) – Dict of file parameter names mapped to a tuple with three items: whether the parameter is required (True), if the parameter is for multiple files (True), and the description of the expected file meta-dataReturns: 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
- :raises
-
validate_properties
(property_names)¶ Validates the given property names to make sure all properties exist if they are required.
Parameters: property_names (dict of str -> bool) – Dict of property names mapped to a bool indicating if they are required 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
- :raises
-
-
class
recipe.configuration.data.recipe_connection.
SeedRecipeConnection
¶ Bases:
object
Represents a connection that will provide data to execute jobs. This class contains the necessary description needed to ensure the data provided by the connection will be sufficient to execute the given job.
-
add_input_file
(file_name, multiple, media_types, optional, partial)¶ Adds a new file parameter to this connection
Parameters: - file_name (str) – The file parameter name
- multiple (bool) – Whether the file parameter provides multiple files (True)
- media_types (list of str) – The possible media types of the file parameter (unknown if None or [])
- optional (bool) – Whether the file parameter is optional and may not be provided (True)
- partial (bool) – Flag indicating if the parameter only requires a small portion of the file
-
add_property
(property_name)¶ Adds a new property parameter to this connection
Parameters: property_name (str) – The property parameter name
-
add_workspace
()¶ Indicates that this connection provides a workspace for storing output files
-
has_workspace
()¶ Indicates whether this connection provides a workspace for storing output files
Returns: True if this connection provides a workspace, False otherwise Return type: bool
-
validate_input_files
(files)¶ Validates the given file parameters to make sure they are valid with respect to the job interface.
Parameters: files ([ job.seed.types.SeedInputFiles
]) – List of file inputsReturns: A list of warnings discovered during validation. Return type: list[ job.configuration.data.job_data.ValidationWarning
]:raises
job.configuration.data.exceptions.InvalidConnection
: If there is a configuration problem.
-
validate_properties
(property_names)¶ Validates the given property names to make sure all properties exist if they are required.
Parameters: property_names (dict of str -> bool) – Dict of property names mapped to a bool indicating if they are required Returns: A list of warnings discovered during validation. Return type: list[ job.configuration.data.job_data.ValidationWarning
]:raises
job.configuration.data.exceptions.InvalidConnection
: If there is a configuration problem.
-
recipe.configuration.data.recipe_data module¶
Defines the data needed for executing a recipe
-
class
recipe.configuration.data.recipe_data.
LegacyRecipeData
(data={})¶ Bases:
object
Represents the data needed for executing a recipe. Data includes details about the data inputs, links needed to connect shared resources to resource instances in Scale, and details needed to store all resulting output.
-
add_file_input
(input_name, file_id)¶ Adds a new file parameter to this recipe data. This method does not perform validation on the recipe data.
Parameters: - input_name (str) – The file parameter name
- file_id (long) – The ID of the file
-
add_input_to_data
(recipe_input_name, job_data, job_input_name)¶ Adds the given input from the recipe data as a new input to the given job data
Parameters: - recipe_input_name (str) – The name of the recipe data input to add to the job data
- job_data (
job.configuration.data.job_data.JobData
) – The job data - job_input_name (str) – The name of the job data input to add
-
get_dict
()¶ Returns the internal dictionary that represents this recipe data
Returns: The internal dictionary Return type: dict
-
get_input_file_ids
()¶ Returns a set of scale file identifiers for each file in the recipe input data.
Returns: Set of scale file identifiers Return type: set[int]
-
get_input_file_info
()¶ Returns a set of file_id and name for each file in recipe input data
Returns: Set of scale file identifiers and names Return type: set[tuple]
-
get_workspace_id
()¶ Returns the workspace ID in the recipe data
Returns: The workspace ID Return type: int
-
set_workspace_id
(workspace_id)¶ Set the workspace ID in the recipe data.
Parameters: workspace_id (int) – The new workspace ID :raises
recipe.configuration.data.exceptions.InvalidRecipeData
: If the workspace ID is an invalid type
-
validate_input_files
(files)¶ Validates the given file parameters to make sure they are valid with respect to the job interface
Parameters: files (dict of str -> tuple(bool, bool, job.configuration.interface.scale_file.ScaleFileDescription
)) – Dict of file parameter names mapped to a tuple with three items: whether the parameter is required (True), if the parameter is for multiple files (True), and the description of the expected file meta-dataReturns: 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_properties
(property_names)¶ Validates the given property names to make sure all properties are populated correctly and exist if they are required
Parameters: property_names (dict of str -> bool) – Dict of property names mapped to a bool indicating if they are required 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_workspace
()¶ Validates the given file parameters to make sure they are valid with respect to the job interface
Returns: A list of warnings discovered during validation. Return type: list[ recipe.configuration.data.recipe_data.ValidationWarning
]:raises
recipe.configuration.data.exceptions.InvalidRecipeData
: If the workspace is missing or invalid
-
-
class
recipe.configuration.data.recipe_data.
ValidationWarning
(key, details)¶ Bases:
object
Tracks recipe data configuration warnings during validation that may not prevent the recipe from working.