Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added a function to normalize the namespace in case of UDP #57

Merged
merged 10 commits into from
Dec 20, 2021

Conversation

JanssenBrm
Copy link
Contributor

Within OpenEO it is possible to share processes through UDP. This results in a shareable URL that needs to be defined in the namespace field of the processing graph. For example, below is a processing graph required to execute a service called tps_evi that is available in the u:marketplace_tps namespace.

{
     "process_graph": {
            "tps_evi": {
                 "process_id": "tps_evi",
                 "namespace": "https://openeo.vito.be/openeo/1.0/processes/u:marketplace_tps/tps_evi",
                 "arguments": {},
                 "result": true
            }
      }
}

In the current implementation of the OpenEO JavaScript client, you can specify a namespace like u:marketplace_tps and get the processes. However, the resulting graph seems to be incorrect:

{
     "process_graph": {
            "tps_evi": {
                 "process_id": "tps_evi",
                 "namespace": "u:marketplace_tps",
                 "arguments": {},
                 "result": true
            }
      }
}

The above processing graph cannot be executed by OpenEO as it is not able to find the process in the u:marketplace_tps namespace.

With this fix, it is possible to define the full url (e.g. https://openeo.vito.be/openeo/1.0/processes/u:marketplace_tps/tps_evi) as the namespace to be loaded by the OpenEO JavaScript client. It uses the normalizeNamespace function to extract the namespace from the URL (if applicable!) in order to get all processes from the OpenEO API.

@m-mohr m-mohr self-requested a review December 17, 2021 13:36
@m-mohr m-mohr self-assigned this Dec 17, 2021
@m-mohr
Copy link
Member

m-mohr commented Dec 17, 2021

Interesting, thanks. I'll look into this although I think the implementation as is doesn't fully accomplish what you are looking for. I think it should rather check whether something is a URL or not instead of assuming there's always a u: included.

@JanssenBrm
Copy link
Contributor Author

Thanks for the feeback @m-mohr ! I agree, the code has been refactored a bit to look for URLs that represent shared OpenEO UDPs, such as:
https://openeo.vito.be/openeo/1.0/processes/u:marketplace_tps/tps_evi

src/connection.js Outdated Show resolved Hide resolved
src/connection.js Outdated Show resolved Hide resolved
src/connection.js Outdated Show resolved Hide resolved
@m-mohr
Copy link
Member

m-mohr commented Dec 20, 2021

In the current implementation of the OpenEO JavaScript client, you can specify a namespace like u:marketplace_tps and get the processes. However, the resulting graph seems to be incorrect:
[...]
The above processing graph cannot be executed by OpenEO as it is not able to find the process in the u:marketplace_tps namespace.

By the way, this is not fully correct. The process shown is fully correct, it is simply not sharable, which is not defined in openEO yet. It can be run on the back-end for which it was defined though.

Please note that loading processes from URLs is not supported in any other openEO JS tooling yet, e.g. process graph parser or Web Editor.

JanssenBrm and others added 3 commits December 20, 2021 13:20
Co-authored-by: Matthias Mohr <webmaster@mamo-net.de>
Co-authored-by: Matthias Mohr <webmaster@mamo-net.de>
Co-authored-by: Matthias Mohr <webmaster@mamo-net.de>
@JanssenBrm
Copy link
Contributor Author

JanssenBrm commented Dec 20, 2021

Thanks for the feedback @m-mohr ! I wasn't aware that this feature is very VITO specific. We worked in the assumption that the Python client and JS client support a same set of features. In Python it is possible to share a UDP in public and use the namespace URL to load in the process:

evi = eoconn.datacube_from_process(
    "tps_evi", 
    namespace="https://openeo.vito.be/openeo/1.0/processes/u:marketplace_tps/tps_evi", 
    date=date,
    bbox=bbox
)

It is marked as experimental though.

src/connection.js Outdated Show resolved Hide resolved
@m-mohr
Copy link
Member

m-mohr commented Dec 20, 2021

No, this (sharing) is unspecified and only available at VITO right now. Namespaces are generally available though. As the Python client is also developed by VITO, it also supports the VITO-specific function. JS (and also R) only implement the officially specified functionality (yet).

@m-mohr
Copy link
Member

m-mohr commented Dec 20, 2021

Okay, now it looks good. The last things we need here are

  1. a CHANGELOG entry
  2. updating the TS declaration

@m-mohr m-mohr changed the base branch from master to development December 20, 2021 13:21
@m-mohr m-mohr merged commit 345f7e6 into Open-EO:development Dec 20, 2021
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