Skip to content

Commit 99969e1

Browse files
committed
Issue #668 add changelog and docs on federation extension
1 parent 9093102 commit 99969e1

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- Add initial support for accessing [Federation Extension](https://github.com/Open-EO/openeo-api/tree/master/extensions/federation) related metadata ([#668](https://github.com/Open-EO/openeo-python-client/issues/668))
13+
1214
### Changed
1315

1416
- Improved tracking of metadata changes with `resample_spatial` and `resample_cube_spatial` ([#690](https://github.com/Open-EO/openeo-python-client/issues/690))

docs/federation-extension.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
.. _federation-extension:
3+
4+
===========================
5+
openEO Federation Extension
6+
===========================
7+
8+
9+
The `openEO Federation extension <https://github.com/Open-EO/openeo-api/tree/master/extensions/federation>`_
10+
is a set of additional specifications,
11+
on top of the standard openEO API specification,
12+
to address the need for extra metadata in the context
13+
of federated openEO processing,
14+
where multiple (separately operated) openEO services are bundled together
15+
behind a single API endpoint.
16+
17+
18+
Accessing federation extension metadata
19+
========================================
20+
21+
The openEO Python client library provides access to this additional metadata
22+
in a couple of resources.
23+
24+
.. versionadded:: 0.38.0
25+
initial support to access federation extension related metadata.
26+
27+
Backend details
28+
---------------
29+
30+
Participating backends in a federation are listed under the ``federation`` field
31+
of the capabilities document (``GET /``) and can be inspected
32+
using :py:meth:`OpenEoCapabilities.get_federation() <openeo.rest.capabilities.OpenEoCapabilities.get_federation>`:
33+
34+
.. code-block:: python
35+
36+
import openeo
37+
connection = openeo.connect(url=...)
38+
capabilities = connection.capabilities()
39+
print("Federated backends:", capabilities.get_federation())
40+
41+
42+
Unavailable backends (``federation:missing``)
43+
----------------------------------------------
44+
45+
When listing resources like
46+
collections (with :py:meth:`Connection.list_collections() <openeo.rest.connection.Connection.list_collections>`),
47+
processes (with :py:meth:`Connection.list_processes() <openeo.rest.connection.Connection.list_processes>`),
48+
jobs (with :py:meth:`Connection.list_jobs() <openeo.rest.connection.Connection.list_jobs>`),
49+
etc.,
50+
there might be items missing due to federation participants being temporarily unavailable.
51+
These missing federation components are listed in the response under the ``federation:missing`` field
52+
and can be inspected as follows:
53+
54+
.. code-block:: python
55+
56+
import openeo
57+
connection = openeo.connect(url=...)
58+
collections = connection.list_collections()
59+
print("Number of collections:", len(collections))
60+
print("Missing federation components:", collections.ext_federation.missing)
61+
62+
63+
Note that the ``collections`` object in this example, returned by
64+
:py:meth:`Connection.list_collections() <openeo.rest.connection.Connection.list_collections>`,
65+
acts at the surface as a simple list of dictionaries with collection metadata,
66+
but also provides additional properties/methods like
67+
:py:attr:`ext_federation <openeo.rest.models.general.CollectionListingResponse.ext_federation>`.
68+
This is an accessor (an instance of :py:class:`FederationExtension <openeo.rest.models.federation_extension.FederationExtension>`)

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Table of contents
6464
process_mapping
6565
development
6666
best_practices
67+
Federation extension <federation-extension>
6768
changelog
6869

6970

openeo/rest/capabilities.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def get_federation(self) -> Union[Dict[str, dict], None]:
6060
if this backend acts as a federated backend,
6161
as specified in the openEO Federation Extension.
6262
Returns ``None`` otherwise
63+
64+
.. versionadded:: 0.38.0
6365
"""
6466
# TODO: also check related conformance class in `/conformance`?
67+
# TODO: refactor into FederationExtension
68+
# TODO: return a richer object instead of raw dicts?
6569
return self.get("federation")

openeo/rest/models/federation_extension.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
class FederationExtension:
77
"""
88
Wrapper the openEO Federation extension as defined by
9-
https://github.com/Open-EO/openeo-api/tree/draft/extensions/federation
9+
https://github.com/Open-EO/openeo-api/tree/master/extensions/federation
10+
11+
.. seealso:: :ref:`federation-extension`
1012
"""
1113

1214
__slots__ = ["_data"]

0 commit comments

Comments
 (0)