Skip to content

[ManagedJobs] Autoscaling worker pool for job submission - #6260

Merged
cg505 merged 123 commits into
masterfrom
batch-pool-chimera
Jul 31, 2025
Merged

[ManagedJobs] Autoscaling worker pool for job submission#6260
cg505 merged 123 commits into
masterfrom
batch-pool-chimera

Conversation

@cblmemo

@cblmemo cblmemo commented Jul 14, 2025

Copy link
Copy Markdown
Collaborator

TODO:

  • Pool cli (sky jobs pool up / sky jobs create-pool)
  • --batch-size / --jobs-replica / ...
  • pool spec schema

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

@cblmemo
cblmemo requested a review from cg505 July 15, 2025 20:33
@cblmemo

cblmemo commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator Author

/smoke-test --serve

@cblmemo

cblmemo commented Jul 17, 2025

Copy link
Copy Markdown
Collaborator Author

/smoke-test --serve

@cblmemo

cblmemo commented Jul 17, 2025

Copy link
Copy Markdown
Collaborator Author

/smoke-test --serve

@cblmemo

cblmemo commented Jul 17, 2025

Copy link
Copy Markdown
Collaborator Author

/smoke-test --serve

@cblmemo

cblmemo commented Jul 17, 2025

Copy link
Copy Markdown
Collaborator Author

/smoke-test --serve

Comment thread sky/serve/client/impl.py Outdated
Comment thread sky/client/cli/command.py Outdated
@cblmemo

cblmemo commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator Author

/quicktest-core
/smoke-test

@cblmemo

cblmemo commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator Author

/quicktest-core
/smoke-test

@cblmemo

cblmemo commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator Author

/quicktest-core
/smoke-test

@cblmemo

cblmemo commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator Author

/quicktest-core
/smoke-test

Comment thread sky/jobs/server/core.py
handle=local_handle,
all_file_mounts=controller_task.file_mounts,
storage_mounts=controller_task.storage_mounts)
with sky_logging.silent():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why the addition?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To suppress the (mostly) meaningless file mount logs. Those file mount are the one we internally setup in jobs controller (local user yaml -> remote (jobs controller) user yaml). I dont think exposing it to user helps

Comment thread sky/jobs/recovery_strategy.py Outdated
path = pathlib.Path(serve_constants.SKYSERVE_METADATA_DIR)
if pool is not None:
path = path / pool
path = path / 'pm.lock'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would still like to rename this file if possible.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point! Renamed to pool.lock

Comment thread sky/jobs/recovery_strategy.py Outdated


def _get_pool_filelock_path(pool: Optional[str]) -> str:
path = pathlib.Path(serve_constants.SKYSERVE_METADATA_DIR)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we just set this to something for jobs? Weird that it's using the skyserve metadata dir but it's in sky/jobs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The problem is that we want to cleanup the lock for a specific pool after termination of a pool. Currently it is put in ~/.sky/serve/<service-name>, which will be cleanup after the service is down. If we put this lock in jobs path, we need to cleanup corresponding jobs path in serve code, which is also very weird.

Edit: I moved the code (and filelock) to serve_utils, cuz we are already using managed_jobs_state in the get_next_cluster_name function (which is required to track resources), hopefully this is less weird. We need somewhere to call both serve DB and jobs DB anyway..

Comment thread sky/serve/serve_utils.py Outdated
Comment thread sky/serve/server/impl.py Outdated
Comment on lines +565 to +584
def apply(
task: 'sky.Task',
service_name: str,
mode: serve_utils.UpdateMode = serve_utils.DEFAULT_UPDATE_MODE,
pool: bool = False,
) -> None:
"""Applies the config to the service or pool."""
try:
handle = backend_utils.is_controller_accessible(
controller=controller_utils.Controllers.SKY_SERVE_CONTROLLER,
stopped_message='')
backend = backend_utils.get_backend_from_handle(handle)
assert isinstance(backend, backends.CloudVmRayBackend)
service_record = _get_service_record(service_name, pool, handle,
backend)
if service_record is not None:
return update(task, service_name, mode, pool)
except exceptions.ClusterNotUpError:
pass
up(task, service_name, pool)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is a race condition possible here btw?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point! Added a filelock per service name.

@cblmemo

cblmemo commented Jul 30, 2025

Copy link
Copy Markdown
Collaborator Author

/quicktest-core
/smoke-test

Comment thread sky/jobs/recovery_strategy.py
@cg505

cg505 commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator

/smoke-test --managed-jobs

@cg505

cg505 commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator

/smoke-test

@cg505
cg505 force-pushed the batch-pool-chimera branch from f56aece to 01aa96c Compare July 31, 2025 03:28
@cg505
cg505 merged commit 2801510 into master Jul 31, 2025
15 checks passed
@cg505
cg505 deleted the batch-pool-chimera branch July 31, 2025 04:21
@cblmemo
cblmemo restored the batch-pool-chimera branch August 4, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants