Skip to content

Client: Support for multiple result nodes #391

Closed

Description

@soxofaan

follow up of Open-EO/openeo-processes#401

python client needs some kind of support for building process graphs with multiple result nodes

Activity

  1. self-assigned this
    on Aug 14, 2024
  2. jdries commented on Aug 14, 2024

    @jdries
    Collaborator

    It looks like we can create a valid process graph from multiple datacubes, as long as we use the same flattener.

        week = s2cube.aggregate_temporal_period(period="week",reducer="median")
        month = s2cube.aggregate_temporal_period(period="month",reducer="median")
    
        cube1=week.save_result("netCDF")
        cube2 = month.save_result("netCDF")
    
        from openeo.internal.graph_building import GraphFlattener
        flattener = GraphFlattener()
        dict1 = flattener.flatten(cube1.result_node())
    
        #only one node can be marked as 'result':True, so set all others to False
        for v in dict1.values():
            v["result"] = False
    
        secondary_result = cube2.result_node()
    
        #by reusing the flattener, the previously flattened nodes are also included
        dict2 = flattener.flatten(secondary_result)
    
        final_graph = {"process_graph":dict2}
        import json
        merged = json.dumps(final_graph, indent=2)
        print(merged)
    
        connection = openeo.connect("openeo.dataspace.copernicus.eu")
        connection.create_job(final_graph,title="job with 2 save results")
    
  3. removed their assignment
    on Aug 14, 2024
  4. jdries commented on Aug 14, 2024

    @jdries
    Collaborator

    so way forward is either updating create_job or a variant of that method that accepts multiple datacubes?

    or
    cube.execute_batch(args..., extra_cubes=[extra_cube1])
    or
    connection.execute_batch([cube1,cube2]), other args...)

  5. soxofaan commented on Aug 19, 2024

    @soxofaan
    MemberAuthor

    In the python client we already have a base class _ProcessGraphAbstraction, which is further implemented by DataCube, VectorCube, MlModel. So I was thinking along the lines of creating another subclass of that, say ProcessGraph or MultiResult, which you can pass one or more cubes and work with that. E.g.

    results = MultiResult([cube_as_tiff, cube_as_netcdf, vector_cube])
    
    results.execute_batch(...)

    (all naming up for discussion of course)

  6. added 7 commits that reference this issue on Sep 24, 2024
  7. 7 remaining items

  8. added 11 commits that reference this issue on Oct 29, 2024
  9. soxofaan commented on Nov 5, 2024

    @soxofaan
    MemberAuthor

    ready to merge:

    just waiting for quick review if possible

  10. added a commit that references this issue on Nov 6, 2024
  11. soxofaan commented on Nov 6, 2024

    @soxofaan
    MemberAuthor

    merged #651

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions