Skip to content

export_workspace not possible when running UDP with datacube_from_process #844

Open

Description

@VincentVerelst

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)

Activity

  1. soxofaan commented on Jan 7, 2026

    @soxofaan
    Member

    indeed, I noticed we encounter this problem more and more, so I started this more general ticket:

    Would it be possible to allow to call export_workspace directly on a DataCube object?

    No, that's intentionally a design that we want to avoid: the openEO process export_workspace works with a STAC resource, so it should not be a method 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?

    What you want, I think, (and that's what #845 is about), is a helper that is smart enough to give you a SaveResult (e.g. by inspecting the UDP return type), e.g.

    save_result = connection.process(process_id='worldcereal_crop_type', ...)
    # save_result is automatically a SaveResult object here
    cube.export_workspace(...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions