1676 Manager pass job_id to processor (#1680)

* Allow the processor to know the process_id

Solve issue  #1676

* Update base.py

* Cleared blanc lines

* Added set_job_id() function description

* Update base.py

* Update base.py

---------

Co-authored-by: FrancescoIngv <FrancescoIngv@users.noreply.github.com>
Co-authored-by: Tom Kralidis <tomkralidis@gmail.com>
This commit is contained in:
francescoingv
2024-06-14 13:35:50 +02:00
committed by GitHub
parent 50ad801acb
commit 7218d95feb
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -49,10 +49,27 @@ class BaseProcessor:
:returns: pygeoapi.processor.base.BaseProvider
"""
self.name = processor_def['name']
self.metadata = process_metadata
self.supports_outputs = False
def set_job_id(self, job_id: str) -> None:
"""
Set the job_id within the processor
To be implemented by derived classes where required.
:param job_id: the job_id assigned to the request by the Manager.
The function shuold be called by the Manager upon
assigning the job_id. The job_id is intended to be used
by derived classes, e.g. to write temporary files where
filenames contains the string job_id.
:returns: `None`
"""
pass
def execute(self, data: dict, outputs: Optional[dict] = None
) -> Tuple[str, Any]:
"""
+2
View File
@@ -355,6 +355,8 @@ class BaseManager:
job_id = str(uuid.uuid1())
processor = self.get_processor(process_id)
processor.set_job_id(job_id)
if execution_mode == RequestedProcessExecutionMode.respond_async:
job_control_options = processor.metadata.get(
'jobControlOptions', [])