Skip to content
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

[PERF] Update number of cores on every iteration #1480

Merged
merged 4 commits into from
Oct 10, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions daft/runners/ray_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,6 @@ def _run_plan(
# Get executable tasks from plan scheduler.
tasks = plan_scheduler.to_partition_tasks(psets, is_ray_runner=True)

# Note: For autoscaling clusters, we will probably want to query cores dynamically.
# Keep in mind this call takes about 0.3ms.
cores = int(ray.cluster_resources()["CPU"]) - self.reserved_cores

max_inflight_tasks = cores + self.max_task_backlog

inflight_tasks: dict[str, PartitionTask[ray.ObjectRef]] = dict()
inflight_ref_to_task: dict[ray.ObjectRef, str] = dict()

Expand All @@ -453,6 +447,10 @@ def _run_plan(
next_step = next(tasks)

while True: # Loop: Dispatch -> await.
# This call takes about 0.3ms and hits a locally in-memory cached record of cluster resources
cores: int = int(ray.cluster_resources()["CPU"]) - self.reserved_cores
max_inflight_tasks = cores + self.max_task_backlog

while True: # Loop: Dispatch (get tasks -> batch dispatch).
tasks_to_dispatch: list[PartitionTask] = []

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might even want to do it here, this is where batches are dispatched up to the limit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github UI is being unclear, but I mean the last line of that block, 458/456

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved into inner loop and guarded it with a TTL

Expand Down
Loading