job.seed package¶
Subpackages¶
Submodules¶
job.seed.exceptions module¶
Defines exceptions that can occur when interacting with a Seed job interface
-
exception
job.seed.exceptions.InvalidSeedManifestDefinition(name, description)¶ Bases:
util.exceptions.ValidationExceptionException indicating that the provided definition of a Seed Manifest was invalid
-
exception
job.seed.exceptions.InvalidSeedMetadataDefinition(name, description)¶ Bases:
util.exceptions.ValidationExceptionException indicating that the provided definition of a Seed Metadata was invalid
job.seed.manifest module¶
Defines the interface for executing a job
-
class
job.seed.manifest.SeedManifest(definition, do_validate=True)¶ Bases:
objectRepresents the interface defined by an algorithm developer to a Seed job
-
add_output_to_connection(output_name, job_conn, input_name)¶ Adds the given output from the interface as a new input to the given job connection
Parameters: - output_name (str) – The name of the output to add to the connection
- job_conn (
job.data.job_connection.JobConnection) – The job connection - input_name (str) – The name of the connection input
-
add_workspace_to_data(job_data, workspace_id)¶ Adds the given workspace ID to the given job data for every output in this job interface
Parameters: - job_data (
job.data.job_data.JobData) – The job data - workspace_id (int) – The workspace ID
- job_data (
-
get_command()¶ Gets the command :return: the command :rtype: str
-
get_description()¶ Gets the Job description :return: the description :rtype: str
-
get_dict()¶ Returns the internal dictionary that represents this job interface
Returns: The internal dictionary Return type: dict
-
get_error_mapping()¶ Returns the error mapping for this manifest
Returns: The error mapping Return type: job.error.mapping.JobErrorMapping
-
get_errors()¶ Get the error mapping defined for the Seed job
Returns: the error codes mapped for job Return type: list()
-
get_file_output_names()¶ Returns the output parameter names for all file outputs
Returns: The file output parameter names Return type: [string]
-
get_injected_command_args(values, env_vars)¶ Gets the command, injecting env_vars and input variables
Parameters: - values ({str, str}) – Input values to replace named placeholders in command value
- env_vars (dict) – Incoming environment variables
Returns: the command
Return type: str
-
get_input_files()¶ Gets the list of input files defined in the interface
Returns: the input file definitions for job Return type: list()
-
get_input_interface()¶ Returns the input interface for this manifest
Returns: The input interface for this manifest Return type: data.interface.interface.Interface
-
get_input_json()¶ Gets the list of json defined in the interface
Returns: the input json definitions for job Return type: list()
-
get_inputs()¶ Gets the inputs defined in the interface
Returns: the inputs defined for the job Return type: dict
-
get_interface()¶ Gets the interface for the Seed job
Returns: the interface object Return type: dict
-
get_job()¶ Gets the Job object within the Seed manifest
Returns: the Job object
-
get_job_version()¶ Gets the Job version :return: the version :rtype: str
-
get_maintainer()¶ Gets the maintainer details for the Seed job
Returns: the maintainer details of job Return type: dict
-
get_mounts()¶ Gets the mounts defined the Seed job
Returns: the mounts for a job Return type: list()
-
get_name()¶ Gets the Job name :return: the name :rtype: str
-
get_output_files()¶ Gets the list of output files defined in the interface
Commonly used when matching globs to capture output files
Returns: the output file definitions for job Return type: list()
-
get_output_interface()¶ Returns the output interface for this manifest
Returns: The output interface for this manifest Return type: data.interface.interface.Interface
-
get_output_json()¶ Gets the list of output json defined in the interface
Commonly used when matching globs to capture output files
Returns: the output file definitions for job Return type: list()
-
get_outputs()¶ Gets the outputs defined in the interface
Returns: the outputs defined for the job Return type: dict
-
get_package_version()¶ Gets the package version :return: the version :rtype: str
-
get_scalar_resources()¶ Gets the scalar resources defined the Seed job
Returns: the scalar resources required by job Return type: list()
-
get_seed_input_files()¶ Get the list of SeedInputFiles typed results
Returns: list of output files elements Return type: [job.seed.types.SeedInputFiles]
-
get_seed_output_files()¶ Get the list of SeedOutputFiles typed results
Returns: list of output files elements Return type: [job.seed.types.SeedOutputFiles]
-
get_seed_output_json()¶ Get the list of SeedOutputJson typed results
Returns: list of output json elements Return type: [job.seed.types.SeedOutputJson]
-
get_settings()¶ Gets the settings for the Seed job
Returns: the settings object Return type: dict
Gets the Job tags :return: the tags :rtype: [str]
-
get_timeout()¶ Gets the Job timeout
Returns: the version Return type: integer
-
get_title()¶ Gets the Job title :return: the title :rtype: str
-
perform_pre_steps(job_data)¶ Performs steps prep work before a job can actually be run. This includes downloading input files. This returns the command that should be executed for these parameters. :param job_data: The job data :type job_data:
job.data.job_data.JobData
-
validate_connection(job_conn)¶ Validates the given job connection to ensure that the connection will provide sufficient data to run a job with this interface
Parameters: job_conn ( job.seed.data.job_connection.JobConnection) – The job dataReturns: A list of warnings discovered during validation. Return type: list[ job.data.job_data.ValidationWarning]:raises
job.data.exceptions.InvalidConnection: If there is a configuration problem.
-
validate_data(job_data)¶ Ensures that the job_data matches the job_interface description
Parameters: job_data ( job.data.job_data.JobData) – The job dataReturns: A list of warnings discovered during validation. Return type: list[ job.data.job_data.ValidationWarning]:raises
job.data.exceptions.InvalidData: If there is a configuration problem.
-
validate_populated_mounts(exe_configuration)¶ Ensures that all required mounts are defined in the execution configuration
Parameters: exe_configuration ( job.execution.configuration.json.exe_config.ExecutionConfiguration) – The execution configuration
-
validate_populated_settings(exe_configuration)¶ Ensures that all required settings are defined in the execution configuration
Parameters: exe_configuration ( job.execution.configuration.json.exe_config.ExecutionConfiguration) – The execution configuration
-
validate_resources()¶ verifies GPUs are whole numbers
-
validate_workspace_for_outputs(exe_config)¶ Validates the given job’s output workspaces :param exe_config: The job configuration
:raises
job.configuration.data.exceptions.InvalidConfiguration: If there is a configuration problem.
-
job.seed.metadata module¶
Defines the interface for executing a job
-
class
job.seed.metadata.SeedMetadata¶ Bases:
objectRepresents the extended metadata for a single file in Seed job.
Object instantiation from existing JSON should be accomplished via the metadata_from json helper. This will safeguard us from having to deal with FeatureCollection and GeometryCollection objects.
-
data¶ Retrieves the internal dictionary of GeoJSON
-
get_property(key, default=None)¶
-
static
metadata_from_json(metadata, do_validate=True)¶ Creates a metadata object from the given definition. If the definition is invalid, a
job.seed.exceptions.InvalidSeedMetadataDefinitionexception will be thrown.Parameters: - metadata (dict) – The metadata definition
- do_validate (bool) – Whether to perform validation on the JSON schema
Raises: InvalidSeedMetadataDefinition – If schema validation fails
-
properties¶ Retrieves a valid properties dictionary
Returns: Properties found within metadata file Return type: dict
-
set_property(key, value)¶
-
job.seed.types module¶
-
class
job.seed.types.SeedInputFiles(data)¶ Bases:
job.seed.types.SeedFilesConcrete class for Seed input files elements
-
is_media_type_allowed(media_type)¶ Indicates whether the given media type is allowed by this file description
Parameters: media_type (str) – The media type Returns: True if the media type is allowed, False otherwise Return type: bool
-
media_types¶
-
partial¶
-
-
class
job.seed.types.SeedInputJson(data)¶ Bases:
job.seed.types.SeedJsonConcrete class for Seed input JSON elements
-
class
job.seed.types.SeedJson(data)¶ Bases:
object-
name¶
-
python_type¶ Provides an explicit python type to validate against incoming json types
-
required¶
-
type¶
-
-
class
job.seed.types.SeedOutputFiles(data)¶ Bases:
job.seed.types.SeedFilesConcrete class for Seed output files elements
-
get_files()¶ Get a list of absolute paths to files following job execution
Returns: files matched by pattern defined for object Return type: [str] Raises: OutputCaptureError
-
media_type¶
-
pattern¶
-
-
class
job.seed.types.SeedOutputJson(data)¶ Bases:
job.seed.types.SeedJsonConcrete class for Seed output JSON elements
-
json_key¶ Get the preferred key to match in seed.outputs.json for this JSON output
The key member supercedes the name member when specified.
Returns: Key used to capture output JSON Return type: str
-
key¶
-