weaver.processes.wps_package

Representation of WPS process with an internal CWL package definition.

Functions and classes that offer interoperability and conversion between corresponding elements defined as CWL CommandLineTool/Workflow and WPS ProcessDescription in order to generate ADES/EMS deployable Application Package.

Module Contents

weaver.processes.wps_package.LOGGER[source]
weaver.processes.wps_package.PACKAGE_DEFAULT_FILE_NAME = 'package'[source]
weaver.processes.wps_package.PACKAGE_OUTPUT_HOOK_LOG_UUID = 'PACKAGE_OUTPUT_HOOK_LOG_{}'[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_PREP_LOG = 1[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_LAUNCHING = 2[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_LOADING = 5[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_GET_INPUT = 6[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_ADD_EO_IMAGES = 7[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_CONVERT_INPUT = 8[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_PREPARATION = 9[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_CWL_RUN = 10[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_CWL_DONE = 95[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_PREP_OUT = 98[source]
weaver.processes.wps_package.PACKAGE_PROGRESS_DONE = 100[source]
weaver.processes.wps_package.PACKAGE_SCHEMA_CACHE: Dict[str, Tuple[str, str]][source]
weaver.processes.wps_package.get_status_location_log_path(status_location: str, out_dir: Optional[str] = None) str[source]
weaver.processes.wps_package.retrieve_package_job_log(execution: owslib.wps.WPSExecution, job: weaver.datatype.Job, progress_min: weaver.typedefs.Number = 0, progress_max: weaver.typedefs.Number = 100) None[source]

Obtains the underlying WPS execution log from the status file to add them after existing job log entries.

weaver.processes.wps_package.get_process_location(process_id_or_url: Union[Dict[str, Any], str], data_source: Optional[str] = None) str[source]

Obtains the URL of a WPS REST DescribeProcess given the specified information.

Parameters
  • process_id_or_url – process “identifier” or literal URL to DescribeProcess WPS-REST location.

  • data_source – identifier of the data source to map to specific ADES, or map to localhost if None.

Returns

URL of EMS or ADES WPS-REST DescribeProcess.

weaver.processes.wps_package.get_package_workflow_steps(package_dict_or_url: Union[weaver.typedefs.CWL, str]) List[weaver.typedefs.CWL_WorkflowStepReference][source]

Obtain references to intermediate steps of a CWL workflow.

Parameters

package_dict_or_url – process package definition or literal URL to DescribeProcess WPS-REST location.

Returns

list of workflow steps as {“name”: <name>, “reference”: <reference>} where name is the generic package step name, and reference is the id/url of a registered WPS package.

weaver.processes.wps_package._fetch_process_info(process_info_url: str, fetch_error: Type[Exception]) weaver.typedefs.JSON[source]

Fetches the JSON process information from the specified URL and validates that it contains something.

Raises

fetch_error – provided exception with URL message if the process information could not be retrieved.

weaver.processes.wps_package._get_process_package(process_url: str) Tuple[weaver.typedefs.CWL, str][source]

Retrieves the WPS process package content from given process ID or literal URL.

Parameters

process_url – process literal URL to DescribeProcess WPS-REST location.

Returns

tuple of package body as dictionary and package reference name.

weaver.processes.wps_package._get_process_payload(process_url: str) weaver.typedefs.JSON[source]

Retrieves the WPS process payload content from given process ID or literal URL.

Parameters

process_url – process literal URL to DescribeProcess WPS-REST location.

Returns

payload body as dictionary.

weaver.processes.wps_package._get_package_type(package_dict: weaver.typedefs.CWL) weaver.typedefs.Literal[weaver.processes.types.ProcessType.APPLICATION, weaver.processes.types.ProcessType.WORKFLOW][source]
weaver.processes.wps_package._get_package_requirements_normalized(requirements: weaver.typedefs.CWL_AnyRequirements, as_dict: bool = False) weaver.typedefs.CWL_AnyRequirements[source]

Converts CWL package requirements or hints into list or dict representation.

Uniformization of CWL requirements or hints into the list representation (default) or as dict if requested, whether the input definitions where provided using the dictionary definition as {"<req-class>": {<params>}} or the list of dictionary requirements [{<req-class + params>}] each with a class key.

weaver.processes.wps_package._update_package_compatibility(package: weaver.typedefs.CWL) weaver.typedefs.CWL[source]

Update a CWL package with backward compatibility changes if applicable.

weaver.processes.wps_package._load_supported_schemas()[source]

Loads CWL schemas supported by Weaver to avoid validation errors when provided in requirements.

Use a similar strategy as cwltool.main.setup_schema(), but skipping the CLI context and limiting loaded schema definitions to those that Weaver allows. Drops extensions that could cause misbehaving functionalities when other Process types than CWL-based Application Package are used.

This operation must be called before the CWLFactory attempts loading and validating a CWL document.

weaver.processes.wps_package._load_package_content(package_dict: Ellipsis, package_name: str = PACKAGE_DEFAULT_FILE_NAME, data_source: Optional[str] = None, only_dump_file: weaver.typedefs.Literal[True] = False, tmp_dir: Optional[str] = None, loading_context: Optional[cwltool.context.LoadingContext] = None, runtime_context: Optional[cwltool.context.RuntimeContext] = None, process_offering: Optional[weaver.typedefs.JSON] = None) None[source]
weaver.processes.wps_package._load_package_content(package_dict: Ellipsis, package_name: str = PACKAGE_DEFAULT_FILE_NAME, data_source: Optional[str] = None, only_dump_file: weaver.typedefs.Literal[False] = False, tmp_dir: Optional[str] = None, loading_context: Optional[cwltool.context.LoadingContext] = None, runtime_context: Optional[cwltool.context.RuntimeContext] = None, process_offering: Optional[weaver.typedefs.JSON] = None) Tuple[cwltool.factory.Callable, str, weaver.typedefs.CWL_WorkflowStepPackageMap]

Loads CWL package definition using various contextual resources.

Following operations are accomplished to validate the package:

  • Starts by resolving any intermediate sub-packages steps if the parent package is a Workflow in order to recursively generate and validate their process and package, potentially using remote reference. Each of the following operations are applied to every step individually.

  • Package I/O are reordered using any reference process offering hints if provided to generate consistent results.

  • Perform backward compatibility checks and conversions to the package if applicable.

  • The resulting package definition is dumped to a temporary JSON file, to validate the content can be serialized.

  • Optionally, the CWL factory is employed to create the application runner, validating any provided loading and runtime contexts, and considering all resolved Workflow steps if applicable, or the atomic application otherwise.

Parameters
  • package_dict – Package content representation as a dictionary.

  • package_name – Name to use to create the package file and CWL identifiers.

  • data_source – Identifier of the Data Source to map to specific ADES, or map to localhost if None.

  • only_dump_file – Specify if the CWLFactoryCallable should be validated and returned.

  • tmp_dir – Location of the temporary directory to dump files (deleted on exit).

  • loading_contextcwltool context used to create the CWL package.

  • runtime_contextcwltool context used to execute the CWL package.

  • process_offeringJSON body of the process description payload (used as I/O hint ordering).

Returns

If only_dump_file is True, returns None. Otherwise, tuple of:

  • Instance of CWLFactoryCallable

  • Package type (ProcessType.WORKFLOW or ProcessType.APPLICATION)

  • Package sub-steps definitions if package represents a ProcessType.WORKFLOW. Otherwise, empty mapping. Mapping of each step name contains their respective package ID and CWL definition that must be run.

Warning

Specified tmp_dir will be deleted on exit.

weaver.processes.wps_package._merge_package_inputs_outputs(wps_inputs_defs: Ellipsis, cwl_inputs_list: List[weaver.processes.convert.WPS_Input_Type], wps_outputs_defs: Union[List[weaver.processes.convert.ANY_IO_Type], Dict[str, weaver.processes.convert.ANY_IO_Type]], cwl_outputs_list: List[weaver.processes.convert.WPS_Output_Type]) Tuple[List[weaver.processes.convert.JSON_IO_Type], List[weaver.processes.convert.JSON_IO_Type]][source]

Merges corresponding metadata of I/O definitions from CWL and WPS sources.

Merges I/O definitions to use for process creation and returned by GetCapabilities, DescribeProcess using the WPS specifications (from request POST) and CWL specifications (extracted from file).

Note

Parameters cwl_inputs_list and cwl_outputs_list are expected to be in WPS-like format (i.e.: CWL I/O converted to corresponding WPS I/O objects).

See also

Conversion of CWL to WPS-equivalent objects is handled by _get_package_inputs_outputs() and its underlying functions.

Parameters
  • wps_inputs_defs – list or mapping of provided WPS input definitions.

  • cwl_inputs_list – processed list of CWL inputs from the Application Package.

  • wps_outputs_defs – list or mapping of provided WPS output definitions.

  • cwl_outputs_list – processed list of CWL inputs from the Application Package.

Returns

Tuple of (inputs, outputs) consisting of lists of I/O with merged contents between CWL and WPS.

weaver.processes.wps_package._get_package_io(package_factory: cwltool.factory.Callable, io_select: str, as_json: bool) List[weaver.processes.convert.PKG_IO_Type][source]

Retrieves I/O definitions from a validated CWLFactoryCallable.

See also

Factory can be obtained with validation using _load_package_content().

Parameters
  • package_factoryCWL factory that contains I/O references to the package definition.

  • io_select – either WPS_INPUT or WPS_OUTPUT according to what needs to be processed.

  • as_json – toggle to the desired output type. If True, converts the I/O definitions into JSON representation. If False, converts the I/O definitions into WPS objects.

Returns

I/O format depending on value as_json.

weaver.processes.wps_package._get_package_inputs_outputs(package_factory: Ellipsis, as_json: bool = False) Tuple[List[weaver.processes.convert.PKG_IO_Type], List[weaver.processes.convert.PKG_IO_Type]][source]

Generates WPS-like (inputs, outputs) tuple using parsed CWL package definitions.

weaver.processes.wps_package._update_package_metadata(wps_package_metadata: weaver.typedefs.JSON, cwl_package_package: weaver.typedefs.CWL) None[source]

Updates the package WPS metadata dictionary from extractable CWL package definition.

weaver.processes.wps_package._patch_wps_process_description_url(reference: str, process_hint: Optional[weaver.typedefs.JSON]) str[source]

Rebuilds a WPS ProcessDescription URL from other details.

A GetCapabilities request can be submitted with an ID in query params directly. Otherwise, check if a process hint can provide the ID.

weaver.processes.wps_package._generate_process_with_cwl_from_reference(reference: str, process_hint: Optional[weaver.typedefs.JSON] = None) Tuple[weaver.typedefs.CWL, weaver.typedefs.JSON][source]

Resolves the reference type representing a remote Process and generates a CWL package for it.

The reference can point to any definition amongst below known structures: - CWL - WPS-1/2 - WPS-REST - OGC API - Processes

Additionally, provides minimal Process details retrieved from the reference. The number of details obtained will depend on available parameters from its description as well as the number of metadata that can be mapped between it and the generated CWL package.

The resulting Process and its CWL will correspond to a remote instance to which execution should be dispatched and monitored, except if the reference was directly a CWL file.

Warning

Only conversion of the reference into a potential CWL definition is accomplished by this function. Further validations must still be applied to ensure the loaded definition is valid and meets all requirements.

weaver.processes.wps_package.get_application_requirement(package: Ellipsis, search: Optional[weaver.typedefs.CWL_RequirementNames] = None, default: Optional[Union[weaver.typedefs.CWL_Requirement, weaver.typedefs.Default]] = null, validate: bool = True, required: bool = True) Union[weaver.typedefs.CWL_Requirement, weaver.typedefs.Default][source]

Retrieves a requirement or hint from the CWL package definition.

If no search filter is specified (default), retrieve the principal requirement that allows mapping to the appropriate Process implementation. The principal requirement can be extracted for an Application Package of type ProcessType.APPLICATION because only one is permitted simultaneously amongst CWL_REQUIREMENT_APP_TYPES. If the CWL is not of type ProcessType.APPLICATION, the requirement check is skipped regardless of required.

If a search filter is provided, this specific requirement or hint is looked for instead. Regardless of the applied filter, only a unique item can be matched across requirements/hints mapping and/or listing representations.

When validate is enabled, all requirements and hints must also be defined within CWL_REQUIREMENTS_SUPPORTED for the CWL package to be considered valid.

When convert is enabled, any backward compatibility definitions will be converted to their corresponding definition.

Parameters
  • package – CWL definition to parse.

  • search – Specific requirement/hint name to search and retrieve the definition if available.

  • default – Default value to return if no match was found. If None, returns an empty {"class": ""}.

  • validate – Validate supported requirements/hints definition while extracting requested one.

  • required – Validation will fail if no supported requirements/hints definition could be found.

Returns

dictionary that minimally has class field, and optionally other parameters from that requirement.

weaver.processes.wps_package.check_package_instance_compatible(package: weaver.typedefs.CWL) Optional[str][source]

Verifies if an Application Package definition is valid for the employed Weaver instance configuration.

Given that the CWL is invalid for the active application, explains the reason why that package always require remote execution.

When a package can sometimes be executed locally (ADES) or remotely (EMS) depending on the instance configuration, such as in the case of a CWL_REQUIREMENT_APP_DOCKER, return None. This function instead detects cases where a remote server is mandatory without ambiguity related to the current Weaver instance, regardless whether remote should be an ADES or a remote Provider (WPS or ESGF-CWT).

Parameters

package – CWL definition for the process.

Returns

reason message if it must be executed remotely or None if it could be executed locally.

weaver.processes.wps_package.get_auth_requirements(requirement: weaver.typedefs.JSON, headers: Optional[weaver.typedefs.AnyHeadersContainer]) Optional[weaver.datatype.Authentication][source]

Extract any authentication related definitions provided in request headers corresponding to the application type.

Parameters
  • requirementApplication Package requirement as defined by CWL requirements.

  • headers – Requests headers received during deployment.

Returns

Matched authentication details when applicable, otherwise None.

Raises
  • TypeError – When the authentication object cannot be created due to invalid or missing inputs.

  • ValueError – When the authentication object cannot be created due to incorrectly formed inputs.

weaver.processes.wps_package.get_process_identifier(process_info: weaver.typedefs.JSON, package: weaver.typedefs.CWL) str[source]

Obtain a sane name identifier reference from the Process or the Application Package.

weaver.processes.wps_package.get_process_definition(process_offering: Ellipsis, reference: Optional[str] = None, package: Optional[weaver.typedefs.CWL] = None, data_source: Optional[str] = None, headers: Optional[weaver.typedefs.AnyHeadersContainer] = None, builtin: bool = False) weaver.typedefs.JSON[source]

Resolve the process definition considering corresponding metadata from the offering, package and references.

Returns an updated process definition dictionary ready for storage using provided WPS process_offering and a package definition passed by reference or package CWL content. The returned process information can be used later on to load an instance of weaver.wps_package.WpsPackage.

Parameters
  • process_offeringWPS REST-API (WPS-3) process offering as JSON.

  • reference – URL to CWL package, WPS-1 DescribeProcess endpoint or WPS-3 Process endpoint.

  • package – Literal CWL package definition (YAML or JSON format).

  • data_source – Where to resolve process IDs (default: localhost if None).

  • headers – Request headers provided during deployment to retrieve details such as authentication tokens.

  • builtin – Indicate if the package is expected to be a CWL_REQUIREMENT_APP_BUILTIN definition.

Returns

Updated process definition with resolved/merged information from package/reference.

class weaver.processes.wps_package.DirectoryNestedStorage(storage: Union[pywps.inout.storage.file.FileStorage, pywps.inout.storage.s3.S3Storage])[source]

Generates a nested storage for a directory where each contained file will be managed by the storage.

Initializes the storage.

Parameters

storage – Storage implementation that is employed for storing files in a directory-like structure.

property type: pywps.inout.storage.STORE_TYPE[source]
_patch_destination(destination: str) str[source]
_do_store(output: pywps.inout.outputs.ComplexOutput) Tuple[pywps.inout.storage.STORE_TYPE, weaver.typedefs.Path, str][source]

Store all files contained in a directory recursively.

Note

This is called from CachedStorage.store() only if not already in storage using cached output ID.

write(data: AnyStr, destination: str, data_format: Optional[pywps.inout.formats.Format] = None) str[source]

Write data representing the directory itself or dispatch call to base storage for any other file contents.

When the directory itself is targeted, upload an empty bucket object for S3 base storage, or makes the directory structure for base file storage.

url(destination: str) str[source]
Parameters

destination – the name of the output to calculate the url for

Returns

URL where file_name can be reached

location(destination: str) weaver.typedefs.Path[source]

Provides a location for the specified destination. This may be any path, pathlike object, db connection string, URL, etc and it is not guaranteed to be accessible on the local file system :param destination: the name of the output to calculate

the location for

Returns

location where file_name can be found

class weaver.processes.wps_package.WpsPackage(package: weaver.typedefs.CWL = None, payload: Optional[weaver.typedefs.JSON] = None, **kw: Any)[source]
Parameters
  • handler – A callable that gets invoked for each incoming request. It should accept a single pywps.app.WPSRequest argument and return a pywps.app.WPSResponse object.

  • identifier (string) – Name of this process.

  • title (string) – Human readable title of process.

  • abstract (string) – Brief narrative description of the process.

  • keywords (list) – Keywords that characterize a process.

  • inputs – List of inputs accepted by this process. They should be LiteralInput and ComplexInput and BoundingBoxInput objects.

  • outputs – List of outputs returned by this process. They should be LiteralOutput and ComplexOutput and BoundingBoxOutput objects.

  • metadata – List of metadata advertised by this process. They should be pywps.app.Common.Metadata objects.

  • translations (dict[str,dict[str,str]]) – The first key is the RFC 4646 language code, and the nested mapping contains translated strings accessible by a string property. e.g. {“fr-CA”: {“title”: “Mon titre”, “abstract”: “Une description”}}

Creates a WPS-3 Process instance to execute a CWL application package definition.

Process parameters should be loaded from an existing weaver.datatype.Process instance generated using weaver.wps_package.get_process_definition().

Provided kw should correspond to weaver.datatype.Process.params_wps()

property status_filename: str[source]

Obtain the XML status location of this process when executed.

The status location applies the WPS-Output-Context if defined such that any following output or log file references that derive from it will be automatically stored in the same nested context.

property job: weaver.datatype.Job[source]

Obtain the job associated to this package execution as specified by the provided UUID.

Process must be in “execute” state under pywps for this job to be available.

property auth: weaver.typedefs.AnyHeadersContainer[source]
setup_loggers(log_stdout_stderr: bool = True) None[source]

Configures useful loggers to catch most of the common output and/or error messages during package execution.

insert_package_log(result: Union[weaver.typedefs.CWL_Results, cwltool.factory.WorkflowStatus]) List[str][source]

Retrieves additional CWL sub-process logs captures to retrieve internal application output and/or errors.

After execution of this method, the WPS output log (which can be obtained by retrieve_package_job_log()) will have additional stderr/stdout entries extracted from the underlying application package tool execution.

The outputs and errors are inserted as best as possible in the logical order to make reading of the merged logs appear as a natural and chronological order. In the event that both output and errors are available, they are appended one after another as merging in an orderly fashion cannot be guaranteed by outside CWL runner.

Note

In case of any exception, log reporting is aborted and ignored.

Todo

Improve for realtime updates when using async routine (https://github.com/crim-ca/weaver/issues/131)

Parameters

result – output results returned by successful CWL package instance execution or raised CWL exception.

Returns

captured execution log lines retrieved from files

setup_docker_image() Optional[bool][source]

Pre-pull the Docker image locally for running the process if authentication is required to get it.

Returns

success status if operation was successful, or None when it does not apply.

setup_runtime() Dict[str, weaver.typedefs.AnyValueType][source]

Prepares the runtime parameters for the CWL package execution.

Parameter weaver.wps_workdir is the base-dir where sub-dir per application packages will be generated. Parameter workdir is the actual location PyWPS reserved for this process (already with sub-dir). If no weaver.wps_workdir was provided, reuse PyWps parent workdir since we got access to it. Other steps handling outputs need to consider that CWL<->WPS out dirs could match because of this.

Returns

resolved runtime parameters

update_requirements() None[source]

Inplace modification of package to adjust invalid items that would break behaviour we must enforce.

update_effective_user() None[source]

Update effective user/group for the Application Package to be executed.

FIXME: (experimental) update user/group permissions

Reducing permissions is safer inside docker application since weaver/cwltool could be running as root but this requires that mounted volumes have the required permissions so euid:egid can use them.

Overrides cwltool’s function to retrieve user/group id for ones we enforce.

update_status(message: str, progress: weaver.typedefs.Number, status: weaver.status.AnyStatusType, error: Optional[Exception] = None) None[source]

Updates the PyWPS real job status from a specified parameters.

step_update_status(message: Ellipsis, progress: weaver.typedefs.Number, start_step_progress: weaver.typedefs.Number, end_step_progress: weaver.typedefs.Number, step_name: str, target_host: str, status: weaver.status.AnyStatusType, error: Optional[Exception] = None) None[source]
log_message(status: weaver.status.AnyStatusType, message: str, progress: Optional[weaver.typedefs.Number] = None, level: int = logging.INFO) None[source]
exception_message(exception_type: Type[Exception], exception: Optional[Exception] = None, message: str = 'no message', status: weaver.status.AnyStatusType = Status.EXCEPTION, progress: Optional[weaver.typedefs.Number] = None, level: int = logging.ERROR) Exception[source]

Logs to the job the specified error message with the provided exception type.

Returns

formatted exception with message to be raised by calling function.

classmethod map_step_progress(step_index: int, steps_total: int) weaver.typedefs.Number[source]

Calculates the percentage progression of a single step of the full process.

Note

The step procession is adjusted according to delimited start/end of the underlying CWL execution to provide a continuous progress percentage over the complete execution. Otherwise, we would have values that jump around according to whichever progress the underlying remote WPS or monitored CWL employs, if any is provided.

_handler(request: weaver.wps.service.WorkerRequest, response: pywps.response.execute.ExecuteResponse) pywps.response.execute.ExecuteResponse[source]

Method called when process receives the WPS execution request.

must_fetch(input_ref: str, input_type: weaver.processes.constants.PACKAGE_COMPLEX_TYPES) bool[source]

Figures out if file reference should be fetched immediately for local execution.

If anything else than local script/docker, remote ADES/WPS process will fetch it. S3 are handled here to avoid error on remote WPS not supporting it.

make_inputs(wps_inputs: Ellipsis, cwl_inputs_info: Dict[str, weaver.processes.convert.CWL_Input_Type]) Dict[str, weaver.typedefs.ValueType][source]

Converts WPS input values to corresponding CWL input values for processing by the package.

The WPS inputs must correspond to pywps definitions. Multiple values (repeated objects with corresponding IDs) are adapted to arrays as needed. All WPS Complex types are converted to appropriate locations based on data or reference specification.

Parameters
  • wps_inputs – Actual WPS inputs parsed from execution request.

  • cwl_inputs_info – Expected CWL input definitions for mapping.

Returns

CWL input values.

make_location_input_security_check(input_scheme: str, input_type: weaver.typedefs.CWL_IO_ComplexType, input_id: str, input_location: str, input_definition: pywps.inout.inputs.ComplexInput) str[source]

Perform security access validation of the reference, and resolve it afterwards if accessible.

Auto-map local file if possible to avoid useless download from current server. Resolve Vault reference with local file stored after decryption.

Returns

Updated file location if any resolution occurred.

make_location_input(input_type: weaver.typedefs.CWL_IO_ComplexType, input_definition: pywps.inout.inputs.ComplexInput) Optional[weaver.typedefs.JSON][source]

Generates the JSON content required to specify a CWL File or Directory input from a location.

If the input reference corresponds to an HTTP URL that is detected as matching the local WPS output endpoint, implicitly convert the reference to the local WPS output directory to avoid useless download of available file. Since that endpoint could be protected though, perform a minimal HEAD request to validate its accessibility. Otherwise, this operation could incorrectly grant unauthorized access to protected files by forging the URL.

If the process requires OpenSearch references that should be preserved as is, scheme defined by weaver.processes.constants.OpenSearchField.LOCAL_FILE_SCHEME prefix instead of http(s):// is expected.

Any other variant of file reference will be fetched as applicable by the relevant schemes.

If the reference corresponds to a Directory, all files that can be located in it will be fetched as applicable by the relevant scheme of the reference. It is up to the remote location to provide listing capabilities accordingly to view available files.

See also

Documentation details of resolution based on schemes defined in File Reference Types section.

make_outputs(cwl_result: weaver.typedefs.CWL_Results) None[source]

Maps CWL result outputs to corresponding WPS outputs.

make_location_output(cwl_result: weaver.typedefs.CWL_Results, output_id: str) None[source]

Rewrite the WPS output with required location using result path from CWL execution.

Configures the parameters such that PyWPS will either auto-resolve the local paths to match with URL defined by weaver.wps_output_url or upload it to S3 bucket from weaver.wps_output_s3_bucket and provide reference directly.

See also

  • weaver.wps.load_pywps_config()

make_location_storage(storage_type: pywps.inout.storage.STORE_TYPE, location_type: weaver.processes.constants.PACKAGE_COMPLEX_TYPES) Union[pywps.inout.storage.file.FileStorage, pywps.inout.storage.s3.S3Storage, DirectoryNestedStorage][source]

Generates the relevant storage implementation with requested types and references.

Parameters
  • storage_type – Where to store the outputs.

  • location_type – Type of output as defined by CWL package type.

Returns

Storage implementation.

make_tool(toolpath_object: weaver.typedefs.CWL_ToolPathObject, loading_context: cwltool.context.LoadingContext) cwltool.process.Process[source]
get_workflow_step_package(job_name: str) weaver.typedefs.CWL_WorkflowStepPackage[source]

Resolve the step CWL definition under a Workflow.

get_job_process_definition(job_name: str, job_order: weaver.typedefs.JSON, tool: weaver.typedefs.CWL) WpsPackage[source]

Obtain the execution job definition for the given process (Workflow step implementation).

This function is called before running an ADES Job (either from a workflow step or simple EMS Job dispatching).

It must return a weaver.processes.wps_process.WpsProcess instance configured with the proper CWL package definition, ADES target and cookies to access it (if protected).

Parameters
  • job_name – The workflow step or the package id that must be launched on an ADES string

  • job_order – The params for the job dict {input_name: input_value} input_value is one of input_object or array [input_object] input_object is one of string or dict {class: File, location: string} in our case input are expected to be File object

  • tool – Whole CWL config including hints and requirements (see: weaver.processes.constants.CWL_REQUIREMENT_APP_TYPES)