Normalize Skypilot managed job ids to int (#481) - #588
Open
CodersAcademy006 wants to merge 1 commit into
Open
Conversation
`sky.jobs.client.sdk.launch` returns `Optional[List[int]]`, so
`SkypilotJobsExecutor.launch` handed back `[1]` while its annotation
promised `Optional[int]`. The scheduler interpolates that straight into
`f"{cluster}___{task}___{job_id}"`, so the app id became
`cluster___task___[1]` and `parse_app` died on
`int('[1]')`. The managed job kept running while nemo_run lost the handle,
which also broke `nemo experiment status` and `nemo experiment logs`.
Coerce the id in one place: `launch` unwraps the single-element list, and
`parse_app` accepts the bracketed form so app ids already written to
experiment metadata stay readable. The plain `sky.launch` path used by
SkypilotExecutor returns `Optional[int]` and is untouched.
Closes NVIDIA-NeMo#481
Signed-off-by: Srijan Upadhyay <srjnupadhyay@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #481.
Root cause
SkyPilot's managed-jobs SDK returns a list of job ids. From
sky/jobs/client/sdk.pyin skypilot 0.12.3:SkypilotJobsExecutor.launchpassed that value straight through while its own annotation promisedtuple[Optional[int], ...], and the scheduler builds the app id by interpolation (torchx_backend/schedulers/skypilot_jobs.py):So the app id became
cluster___task___[1], and the very next line,SkypilotJobsExecutor.status(app_id=app_id), reachedparse_appand died onint('[1]'). The job itself was already accepted by SkyPilot, so as @jesintharnold reported the managed job keeps running while nemo_run loses the handle, takingnemo experiment statusandnemo experiment logswith it.Change
One helper,
_as_job_id, used from both ends so the two sites cannot drift:launchunwraps the single-element list, restoring theOptional[int]contract its signature already claimed. A list with more than one id asserts with the value in the message rather than silently taking the first.parse_appaccepts the bracketed form, so app ids already persisted in experiment metadata by an affected run remain readable instead of requiring a re-submit.cleanup,logs,cancelandstatusall route throughparse_app, so they are fixed by the same change.SkypilotExecutor(the non-managed path) is deliberately untouched:sky/client/sdk.py'slaunchreturnsTuple[Optional[int], ...], so it never had this bug.Tests
Two in
test/core/execution/test_skypilot_jobs.py:test_launch_normalizes_list_job_idmocks the SDK the way it actually behaves, returning([1], handle), and asserts the id comes back as1and then survives a round trip through the samef"..."app-id shape the scheduler builds. The existingtest_launchmocked(123, handle), an int, which is why CI never saw this.test_parse_app_legacy_list_job_idpins the recovery path for app ids already written as___[123].Verified locally with skypilot 0.12.3 installed: 32 passed in
test/core/execution/test_skypilot_jobs.py, and reverting only thenemo_run/half fails exactly the two new tests.ruff format --diffandruff checkclean.@ko3n1g this one has been open since May 10 with no reviewer and it silently orphans running jobs, so it may be worth prioritising over the other two SkyPilot reports from the same user (#482, #483), which need real cluster access to settle.