Open-EO / Open-EO/openeo-python-client

`export_workspace` not possible when running UDP with `datacube_from_process`

Open
#844 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
217
Forks
56
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Context

I'm trying to run a UDP from a namespace, using datacube_from_process. I'd like to save my results to a workspace using export_workspace. My UDP already contains one or more save_result nodes, so I don't need/want to add it manually anymore.

Problem

datacube_from_process returns a DataCube object. However, export_workspace only works on a SaveResult object. The following code snippet can be used to replicate the error:


cube = connection.datacube_from_process(
    process_id='worldcereal_crop_type',
    namespace=namespace,
    spatial_extent=spatial_extent,
    temporal_extent=temporal_extent,
    model_url=model_url,
)

cube = cube.export_workspace(
    workspace="worldcereal-phase2-waw4-1-workspace",
    merge="worldcereal_global_croptype_benchmark_50km",
)

will result in

AttributeError: 'DataCube' object has no attribute 'export_workspace'

Discussion

Would it be possible to allow to call export_workspace directly on a DataCube object? Or, if there's a good reason not to: how can we allow to easily add an export_workspace node to a UDP?

Workaround

For now, I can continue, by adding the following line of code between datacube_from_process and export_workspace:

from openeo.rest.result import SaveResult
cube = SaveResult(cube._pg, connection)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the DataCube returned by datacube_from_process with openeo.rest.result.SaveResult and its export_workspace behavior. Determine whether DataCube should support the operation directly or whether a supported way to add the export_workspace node to a UDP is needed. Done means the reported AttributeError is resolved and the provided workflow can export the result without the private _pg workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.