Skip to content

feature: artifact-helper - #750

Merged
pvbouwel merged 2 commits into
Open-EO:masterfrom
pvbouwel:feature/openeo-client-artifact-uploader
Aug 21, 2025
Merged

feature: artifact-helper#750
pvbouwel merged 2 commits into
Open-EO:masterfrom
pvbouwel:feature/openeo-client-artifact-uploader

Conversation

@pvbouwel

Copy link
Copy Markdown
Contributor

Allow uploading artifacts using:

from openeo.extra.artifacts import ArtifactHelper

artifact_helper = ArtifactHelper.from_openeo_connection(connection)
storage_uri = artifact_helper.upload_file(object_name, src_file_path)
presigned_uri = artifact_helper.get_presigned_url(storage_uri)

Where object_name is a logical string name that will be used to give a unique name in the backend storage.
And src_file_path points to a local file that needs to be stored remotely.

This MVP version still has the sts and s3 URIs hard coded. This is temporary. It is possible to expand the links that are exposed at the root_url (https://openeo.dataspace.copernicus.eu/openeo/1.2/) to include rels like 'artifacts-s3-endpoint' and 'artifacts-sts-endpoint'. That way different artifact backends can be chosen based on the OpenEO environment.

@pvbouwel
pvbouwel requested review from jdries and soxofaan March 13, 2025 14:39

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite a large diff 😄 and I haven't gone deep yet, but here are some initial notes

Comment thread openeo/extra/artifacts/internal_s3/artifact_helper.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/config.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/config.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/model.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/model.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/sts.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/sts.py Outdated
Comment thread openeo/extra/artifacts/uri.py
Comment thread setup.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/config.py Outdated
Comment thread openeo/extra/artifacts/internal_s3/artifact_helper.py Outdated

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit short on resources to go deep, so just some superficial notes:

This PR adds a lot of new things (lot of new modules, lot of classes) to the public API of the openeo package. Is it necessary to make all of this public? Once something is public, it's hard to change things because you have to care about compatibility. It's also overwhelming to the user I think.

I also think this feature should be documented in the docs, e.g. somewhere under https://open-eo.github.io/openeo-python-client/cookbook/index.html . Doing that documentation exercise will also make it more clear what the minimal public user-facing part of the API is.
I see you already did some docs on ArtifactHelper, so it should be easy to bootstrap initial docs from that like done at

.. autoclass:: openeo.extra.job_management.MultiBackendJobManager
:members:

@pvbouwel
pvbouwel force-pushed the feature/openeo-client-artifact-uploader branch from d78de33 to f6b3809 Compare June 27, 2025 12:30
@pvbouwel

Copy link
Copy Markdown
Contributor Author

@soxofaan provided docs as requested. I did move around code but mostly renames of files to start with _ to discourage users from entering.

Other changes:

  • introduced feature_flags for s3sts such that backend can advertise what is supports
  • now decided on advertised feature flag whether to enable/disable checksumming
  • more tests
  • Added JSON lexer for sphinx as JSON would not render properly otherwise

@pvbouwel
pvbouwel requested a review from soxofaan June 27, 2025 12:37
@pvbouwel
pvbouwel force-pushed the feature/openeo-client-artifact-uploader branch from d3d610d to 2dd009f Compare July 16, 2025 08:10
@pvbouwel

Copy link
Copy Markdown
Contributor Author

Unittests are failing because of another change: #788

@pvbouwel
pvbouwel force-pushed the feature/openeo-client-artifact-uploader branch from 46c5b80 to 020627f Compare July 22, 2025 08:40

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying to squeeze in some more review notes before the holidays

Comment thread docs/conf.py Outdated
Comment thread docs/conf.py
Comment thread docs/api-artifacts.rst Outdated
Comment thread openeo/extra/artifacts/_s3sts/artifact_helper.py Outdated
Comment thread docs/api-artifacts.rst Outdated
Comment thread docs/cookbook/sampling.md Outdated
Comment thread docs/_ext/jsonlexer.py Outdated
}


class ArtifactHelper(ArtifactHelperBuilderABC):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I'm getting a bit confused by these helper and helperbuilder class hierarchies.

there is ArtifactHelperBuilderABC and ArtifactHelperABC in _artifact_helper_abc.py

And here you have ArtifactHelper which is subclass of ArtifactHelperBuilderABC (instead of ArtifactHelperABC). Or should this call be called ArtifactHelperBuilder?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I understand the need for a hierarchy of helper classes,
I'm not sure I understand the need for a hierarchy for helperbuilder classes.
Wouldn't you just need a single helper builder endpoint (e.g. a single function) instead of a whole hierarchy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right. I believe this stems from when it was unclear to use the capabilities and to allow multiple builder implementations but this is adding unnecessary complexity early on. As you pointed out in he first comment the name is also not the greatest adding confusion into the mix so a 1-function builder endpoint sounds much more appropriate. I replaced the logic with a build_artifact_helper as build_ is used already in other places of the code base.

soxofaan added a commit that referenced this pull request Jul 25, 2025
Inspired by and test for PR #750

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more notes

Comment thread setup.py Outdated
Comment thread setup.py
Comment thread setup.py Outdated

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more nitpicking 😛

Comment thread docs/api-artifacts.rst
Comment thread docs/api-artifacts.rst
Comment thread docs/api-artifacts.rst Outdated
Comment thread docs/api-artifacts.rst Outdated
Comment thread docs/api-artifacts.rst Outdated
Comment thread docs/api-artifacts.rst Outdated
Comment thread docs/api-artifacts.rst Outdated
Comment thread openeo/extra/artifacts/_backend.py Outdated
Comment thread openeo/extra/artifacts/_artifact_helper_abc.py Outdated
Comment thread openeo/extra/artifacts/exceptions.py Outdated
@soxofaan

soxofaan commented Aug 8, 2025

Copy link
Copy Markdown
Member

I would also add a changelog entry along the lines of

- Initial/experimental implementation of artifact upload helper ([Open-EO/openeo-api#566](https://github.com/Open-EO/openeo-api/issues/566))

Comment thread docs/api-artifacts.rst
@pvbouwel
pvbouwel force-pushed the feature/openeo-client-artifact-uploader branch from 867d403 to de1afc2 Compare August 14, 2025 11:33

@soxofaan soxofaan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd merge latest master in this feature branch

Comment thread docs/api-artifacts.rst Outdated
Allow uploading artifacts using:
```
from openeo.extra.artifacts import build_artifact_helper

artifact_helper = build_artifact_helper(connection)
storage_uri = artifact_helper.upload_file(path, object_name)
presigned_uri = artifact_helper.get_presigned_url(storage_uri)
```
@pvbouwel
pvbouwel force-pushed the feature/openeo-client-artifact-uploader branch from 0802667 to d9c6eb2 Compare August 21, 2025 09:42
@pvbouwel
pvbouwel merged commit 6f8d0c8 into Open-EO:master Aug 21, 2025
8 checks passed
@pvbouwel
pvbouwel deleted the feature/openeo-client-artifact-uploader branch August 21, 2025 09:46
soxofaan added a commit that referenced this pull request Sep 9, 2025
Inspired by and test for PR #750
soxofaan added a commit that referenced this pull request Sep 9, 2025
Inspired by and test for PR #750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants