Skip to content

Commit

Permalink
Issue #604/#644 changelog entry and usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Oct 14, 2024
1 parent ade5258 commit d29d3ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Also added `create_job_db()` factory to easily create a job database from a given dataframe and its type guessed from filename extension.
([#635](https://github.com/Open-EO/openeo-python-client/issues/635))
- `MultiBackendJobManager.run_jobs()` now returns a dictionary with counters/stats about various events during the job run ([#645](https://github.com/Open-EO/openeo-python-client/issues/645))
- Added `UDPJobFactory` to be used as `start_job` callable with `MultiBackendJobManager` to create multiple jobs from a single parameterized process (e.g. a UDP or remote process definition) ([#604](https://github.com/Open-EO/openeo-python-client/issues/604))

### Changed

Expand Down
27 changes: 27 additions & 0 deletions openeo/extra/job_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,32 @@ class UDPJobFactory:
Batch job factory based on a parameterized process definition
(e.g a user-defined process (UDP) or a remote process definition),
to be used together with :py:class:`MultiBackendJobManager`.
Usage example with a remote process definition:
.. code-block:: python
from openeo.extra.job_management import (
MultiBackendJobManager,
create_job_db,
UDPJobFactory,
)
# Job creator, based on a parameterized openEO process definition
job_starter = UDPJobFactory(
process_id="my_process",
namespace="https://example.com/my_process.json",
)
# Initialize job database from dataframe, with parameters to use.
df = pd.DataFrame(...)
job_db = create_job_db("jobs.csv").initialize_from_df(df)
# Create and run job manager
job_manager = MultiBackendJobManager(...)
job_manager.run_jobs(job_db=job_db, start_job=job_starter)
.. versionadded:: 0.33.0
"""

def __init__(
Expand All @@ -954,6 +980,7 @@ def __init__(
parameter_defaults: Optional[dict] = None,
parameter_column_map: Optional[dict] = None,
):
# TODO: allow process_id to be None too? when remote process definition fully comes from URL
self._process_id = process_id
self._namespace = namespace
self._parameter_defaults = parameter_defaults or {}
Expand Down

0 comments on commit d29d3ee

Please sign in to comment.