Skip to content

Commit 40474c8

Browse files
committed
Issue #115 allow AggregatorBatchJobs to get backend id for given collection id
1 parent 35c1d93 commit 40474c8

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/openeo_aggregator/backend.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def set_backends_for_collection(self, cid: str, backends: Iterable[str]):
111111
self._data[cid]["backends"] = list(backends)
112112

113113
def get_backends_for_collection(self, cid: str) -> List[str]:
114+
"""Get backend ids that provide given collection id."""
114115
if cid not in self._data:
115116
raise CollectionNotFoundException(collection_id=cid)
116117
return self._data[cid]["backends"]
@@ -205,6 +206,11 @@ def evaluate(backend_id, pg):
205206

206207
return [functools.partial(evaluate, pg=pg) for pg in process_graphs]
207208

209+
def get_backends_for_collection(self, cid: str) -> List[str]:
210+
"""Get backend ids that provide given collection id."""
211+
metadata, internal = self._get_all_metadata_cached()
212+
return internal.get_backends_for_collection(cid=cid)
213+
208214
def get_backend_candidates_for_collections(self, collections: Iterable[str]) -> List[str]:
209215
"""
210216
Get backend ids providing all given collections
@@ -568,13 +574,16 @@ def _process_load_ml_model(
568574
class AggregatorBatchJobs(BatchJobs):
569575

570576
def __init__(
571-
self,
572-
backends: MultiBackendConnection,
573-
processing: AggregatorProcessing,
574-
partitioned_job_tracker: Optional[PartitionedJobTracker] = None,
577+
self,
578+
*,
579+
backends: MultiBackendConnection,
580+
catalog: AggregatorCollectionCatalog,
581+
processing: AggregatorProcessing,
582+
partitioned_job_tracker: Optional[PartitionedJobTracker] = None,
575583
):
576584
super(AggregatorBatchJobs, self).__init__()
577585
self.backends = backends
586+
self._catalog = catalog
578587
self.processing = processing
579588
self.partitioned_job_tracker = partitioned_job_tracker
580589

@@ -1127,8 +1136,9 @@ def __init__(self, backends: MultiBackendConnection, config: AggregatorConfig):
11271136

11281137
batch_jobs = AggregatorBatchJobs(
11291138
backends=backends,
1139+
catalog=catalog,
11301140
processing=processing,
1131-
partitioned_job_tracker=partitioned_job_tracker
1141+
partitioned_job_tracker=partitioned_job_tracker,
11321142
)
11331143

11341144
secondary_services = AggregatorSecondaryServices(backends=backends, processing=processing, config=config)

src/openeo_aggregator/partitionedjobs/crossbackend.py

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def run_partitioned_job(
186186
) -> dict:
187187
"""
188188
Run partitioned job (probably with dependencies between subjobs)
189+
with an active polling loop for tracking and scheduling the subjobs
189190
190191
.. warning::
191192
this is experimental functionality

0 commit comments

Comments
 (0)