Skip to content

UDP storing: add support for categories, returns, links, ... #242

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

Closed
soxofaan opened this issue Oct 4, 2021 · 6 comments
Closed

UDP storing: add support for categories, returns, links, ... #242

soxofaan opened this issue Oct 4, 2021 · 6 comments

Comments

@soxofaan
Copy link
Member

soxofaan commented Oct 4, 2021

(from #223)

def store(
self, process_graph: Union[dict, ProcessBuilderBase], parameters: List[Union[Parameter, dict]] = None,
public: bool = False, summary: str = None, description: str = None
):
process = build_process_dict(
process_graph=process_graph, parameters=parameters,
summary=summary, description=description
)
# TODO: this "public" flag is not standardized yet EP-3609, https://github.com/Open-EO/openeo-api/issues/310
process["public"] = public
self._connection.put(path="/process_graphs/{}".format(self.user_defined_process_id), json=process)

add support for additional UDP properties: categories, returns, examples, links

@soxofaan soxofaan changed the title UDP storing: add support for categories UDP storing: add support for categories, returns, links, ... Oct 4, 2021
@jonathom jonathom linked a pull request Oct 11, 2021 that will close this issue
soxofaan pushed a commit that referenced this issue Nov 3, 2021
soxofaan pushed a commit that referenced this issue Nov 3, 2021
Co-authored-by: Matthias Mohr <m.mohr@uni-muenster.de>
soxofaan pushed a commit that referenced this issue Nov 3, 2021
soxofaan pushed a commit that referenced this issue Nov 3, 2021
soxofaan added a commit that referenced this issue Nov 3, 2021
@soxofaan
Copy link
Member Author

soxofaan commented Nov 3, 2021

done

@soxofaan soxofaan closed this as completed Nov 3, 2021
@m-mohr
Copy link
Member

m-mohr commented Nov 3, 2021

@soxofaan Is there a way to enrich the metadata of a process without storing it? That's what I'm looking for in code generation...

@soxofaan
Copy link
Member Author

soxofaan commented Nov 3, 2021

I'm not sure what you mean, do you have an example/pseudo code what you want to do?

@m-mohr
Copy link
Member

m-mohr commented Nov 3, 2021

In JS (and soon in R) I can so something like:

let builder = await connection.buildProcess();

// Set the metadata for the process
builder.description = "# Moisture Stress Index\nCalculate MSI for an area specifying co...";
builder.id = "MSI";
builder.categories = ["foo", "bar"];
builder.summary = "MSI calculation";

let loadcollection1 = builder.load_collection(...);

print(builder.toJSON());

Which allows me to print the full metadata with all the additional metadata such as id, summary, categories. I'm not sure how I can set the metadata in Python though. When I was implementing code generation you said that's not possible yet and my hope was that this issue would tackle this. If that's not the case, I can open a new one... @soxofaan

@soxofaan
Copy link
Member Author

soxofaan commented Nov 4, 2021

there is openeo.rest.udp.build_process_dict to simplify building a dictionary with UDP fields
e.g.

def test_build_process_dict_from_datacube(con100):
data = Parameter.number("data")
cube = con100.datacube_from_process("add", x=data, y=1)
actual = build_process_dict(
process_graph=cube,
process_id="increment", summary="Increment value", description="Add 1 to input.",
parameters=[data],
returns={"schema": {"type": "number"}}
)
expected = {
"id": "increment",
"description": "Add 1 to input.",
"summary": "Increment value",
"process_graph": {
"add1": {"arguments": {"x": {"from_parameter": "data"}, "y": 1}, "process_id": "add", "result": True}
},
"parameters": [{"name": "data", "description": "data", "schema": {"type": "number"}}],
"returns": {"schema": {"type": "number"}},
}
assert actual == expected

It requires that you already have a process graph or data cube, but I think that's in your use case

@m-mohr
Copy link
Member

m-mohr commented Nov 4, 2021

Thanks, I'll try whether I can make that work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants