rs_workflows/utils/dpr.md¶
Helper task to interact with the DPR as a service.
ProcessingId
¶
Bases: str, Enum
Identifier of a processing, that gives the name of its <processing_id>-default-setting Prefect variable.
Source code in docs/rs-client-libraries/rs_workflows/utils/dpr.py
ProcessorInfo
¶
Bases: BaseModel
Processor run by a processing.
Source code in docs/rs-client-libraries/rs_workflows/utils/dpr.py
ProcessorSettings
¶
Bases: BaseModel
Default settings of a processing, read from its <processing_id>-default-setting Prefect variable, that must
match the config/ProcessorDefaultSettings.schema.json JSON schema.
Source code in docs/rs-client-libraries/rs_workflows/utils/dpr.py
call_dpr_flow(env, settings, input_products, external_variables, workflow, pipeline=None, dask_task_timeout=None, temporary_folder=None, temporary_shared=False)
async
¶
Run a processor with the generic processing flow process-generic, then emit a product.<product type>.generated
event for each generated product. When the workflow is systematic, the automations start the next processing of
the chain from these events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
FlowEnvArgs
|
Flow environment arguments. |
required |
settings
|
ProcessorSettings
|
Default settings of the processing, see |
required |
input_products
|
list[FlowInputProduct]
|
Input products of the processor. |
required |
external_variables
|
dict[str, Any]
|
External variables of the task table ( |
required |
workflow
|
WorkflowType
|
Type of workflow of the processing. |
required |
pipeline
|
str | None
|
Pipeline to run instead of the pipeline or unit of the settings. |
None
|
dask_task_timeout
|
int | None
|
Timeout of the Dask tasks of the processor. |
None
|
temporary_folder
|
str | None
|
Folder of the temporary files of the processor. |
None
|
temporary_shared
|
bool
|
Whether the temporary folder is shared by the Dask workers. |
False
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
The STAC items of the generated products. |
Source code in docs/rs-client-libraries/rs_workflows/utils/dpr.py
dpr_processing_task(*args, **kwargs)
async
¶
generate_payload_path(owner_id)
async
¶
Generates the shared disk path used to store a processing payload for a processor
This function retrieves the storage configuration from a Prefect variable and searches for the first shared-disk configuration that has a valid name and absolute path. The resulting shared-disk path is combined with the owner identifier and the current timestamp to create a unique payload path. TODO: How to retrieve the shared disk related to an organization, and not the first one found in the Prefect variable?
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
owner_id
|
str
|
Identifier of the owner for whom the payload path is generated. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The generated payload path containing the configured shared-disk
base path, owner identifier, and current timestamp in the
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the Prefect variable cannot be retrieved or does not contain a suitable shared-disk configuration with an absolute path. |
Source code in docs/rs-client-libraries/rs_workflows/utils/dpr.py
load_processor_settings(processing_id)
async
¶
Read the default settings of a processing from its <processing_id>-default-setting Prefect variable, check them
against their JSON schema, and check that the Dask clusters of the processing are running.
The flows call it first, before searching their inputs in the catalog or the external stations, so that a configuration error or an unavailable Dask cluster is reported as soon as possible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processing_id
|
ProcessingId
|
Identifier of the processing. |
required |
Returns:
| Type | Description |
|---|---|
ProcessorSettings
|
The default settings of the processing. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the Prefect variable is missing. |
ValueError
|
If the Prefect variable doesn't match the JSON schema, or if a Dask cluster is not running. |