Skip to content

Commit

Permalink
More complete dryrun in validate. Removed validate from /result as it…
Browse files Browse the repository at this point in the history
… is now in load_collection(). Open-EO/openeo-geopyspark-driver#815
  • Loading branch information
EmileSonneveld committed Jun 26, 2024
1 parent e1bb771 commit 719404f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
13 changes: 11 additions & 2 deletions openeo_driver/ProcessGraphDeserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,16 @@ def validate(self, process_graph: dict, env: EvalEnv = None) -> List[dict]:
return [{"code": "ProcessGraphInvalid", "message": str(e)}]

try:
result = convert_node(result_node, env=env)
# Same dry run logic as in evaluate()
_log.info("Doing dry run")
result = convert_node(result_node, env=env.push({
ENV_SAVE_RESULT: [], # otherwise dry run and real run append to the same mutable result list
"node_caching": False
}))
# TODO: work with a dedicated DryRunEvalEnv?
source_constraints = dry_run_tracer.get_source_constraints()
_log.info("Dry run extracted these source constraints: {s}".format(s=source_constraints))
env = env.push({ENV_SOURCE_CONSTRAINTS: source_constraints})
except OpenEOApiException as e:
return [{"code": e.code, "message": str(e)}]
except Exception as e:
Expand Down Expand Up @@ -522,7 +531,7 @@ def _extract_load_parameters(env: EvalEnv, source_id: tuple) -> LoadParameters:
process_types |= set(constraint["process_type"])

_, constraints = filtered_constraints.pop(0)
source_constraints.remove((source_id,constraints))
source_constraints.remove((source_id,constraints)) # Side effect!

params = LoadParameters()
params.temporal_extent = constraints.get("temporal_extent", ["1970-01-01", "2070-01-01"])
Expand Down
15 changes: 1 addition & 14 deletions openeo_driver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,24 +660,11 @@ def result(user: User):
"node_caching": False,
# TODO: more explicit way of passing the job_options instead of putting it in the evaluation env?
"job_options": job_options,
"sync_job": True,
}
)

try:
try:
sync_processing_issues = list(
backend_implementation.processing.verify_for_synchronous_processing(
process_graph=process_graph, env=env
)
)
except Exception as e:
_log.exception(f"Unexpected error while verifying synchronous processing: {e}")
else:
if sync_processing_issues:
raise ProcessGraphComplexityException(
ProcessGraphComplexityException.message + f" Reasons: {' '.join(sync_processing_issues)}"
)

result = backend_implementation.processing.evaluate(process_graph=process_graph, env=env)
_log.info(f"`POST /result`: {type(result)}")

Expand Down

0 comments on commit 719404f

Please sign in to comment.