Skip to content

Commit

Permalink
Pipelines can request ray worker types (#289)
Browse files Browse the repository at this point in the history
* add necessary changes

* refactor a bit

* mute mypy complaint

* rename parameter

* adjust docs

* readd formatting
  • Loading branch information
zigaLuksic authored Oct 27, 2023
1 parent 30e20de commit b65bef8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eogrow/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,11 @@ def run_execution(
executor_class: type[EOExecutor]

execution_kind = self._init_processing()
extra_kwargs = {}
if execution_kind is ProcessingType.RAY:
executor_class = RayExecutor
if self.config.ray_worker_type is not None:
extra_kwargs = {"ray_remote_kwargs": {"resources": {self.config.ray_worker_type: 0.001}}}
else:
executor_class = EOExecutor
executor_run_params["workers"] = self.config.workers
Expand All @@ -194,6 +197,7 @@ def run_execution(
filesystem=self.storage.filesystem,
logs_filter=EOExecutionFilter(ignore_packages=self.logging_manager.config.eoexecution_ignore_packages),
logs_handler_factory=EOExecutionHandler,
**extra_kwargs, # type: ignore[arg-type]
)
execution_results = executor.run(**executor_run_params)

Expand Down
7 changes: 7 additions & 0 deletions eogrow/core/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ class PipelineSchema(BaseSchema):
workers: int = Field(
1, description="Number of workers for parallel execution of workflows. Parameter does not affect ray clusters."
)
ray_worker_type: Optional[str] = Field(
description=(
"Restricts execution of parallelized tasks only to `ray` worker instances of the requested type. The worker"
" section of the `cluster.yaml` file should specify the custom resource with a matching name and the value"
" set to 1."
),
)
use_ray: BoolOrAuto = Field(
"auto",
description=(
Expand Down

0 comments on commit b65bef8

Please sign in to comment.