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

[Core] Add sky jobs logs --name and fix sky job logs spinner #3538

Merged
merged 17 commits into from
May 28, 2024

Conversation

Michaelvll
Copy link
Collaborator

@Michaelvll Michaelvll commented May 10, 2024

This adds support for sky jobs logs --name, fixes #3599, and add test for sky job logs
This is to prevent issue like #3531 with the smoke test.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
    • sky jobs launch -n test-log --cloud aws --gpus H100:8 echo hi and check the output of the spinner
    • sky launch -c test-output --cloud aws task.yaml
    • sky launch -c test-output --cloud gcp task.yaml
    setup: |
      echo setup
    
    run: |
      echo hi
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
    • pytest tests/test_smoke.py::test_managed_jobs
    • pytest tests/test_smoke.py::test_managed_jobs --kubernetes
    • pytest tests/test_smoke.py::test_minimal
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@concretevitamin concretevitamin requested review from romilbhardwaj and removed request for concretevitamin May 10, 2024 18:35
@Michaelvll Michaelvll requested a review from cblmemo May 13, 2024 16:42
sky/cli.py Outdated
Comment on lines 3561 to 3570
if name is not None:
job_queue = managed_jobs.queue(refresh=False)
job_id = None
for job in job_queue:
if job['job_name'] == name:
job_id = job['job_id']
break
if job_id is None:
click.echo(f'Managed job with name {name!r} not found.')
sys.exit(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

To discuss: will this add too much overhead to the sky jobs logs? Now it requires two SSH to the controller IIUC. Also, this seems not used in the smoke test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This might be fine as the code path will only be entered when name is specified which is currently only used in smoke test?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If a user does sky jobs logs --controller -n train-job, then it will also hit this code path?

@Michaelvll Michaelvll modified the milestone: v0.6 May 24, 2024
@Michaelvll Michaelvll changed the title [Test] Add test for job logs [Core] Add sky jobs logs --name and fix sky job logs spinner May 27, 2024
@Michaelvll Michaelvll requested a review from cblmemo May 27, 2024 02:22
Copy link
Collaborator

@cblmemo cblmemo left a comment

Choose a reason for hiding this comment

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

Thanks for adding this @Michaelvll ! Left some discussions :))

sky/jobs/utils.py Show resolved Hide resolved
sky/jobs/utils.py Outdated Show resolved Hide resolved
sky/jobs/utils.py Outdated Show resolved Hide resolved
sky/jobs/utils.py Show resolved Hide resolved
sky/jobs/utils.py Outdated Show resolved Hide resolved
from sky.jobs import utils
from sky.jobs import constants as managed_job_constants
from sky.jobs import state as managed_job_state
from typing import Optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is needed as we inspect.getsource the function stream_logs, which uses Optional in its signature. Moved this import to the later place.

sky/skylet/constants.py Show resolved Hide resolved
sky/utils/command_runner.py Show resolved Hide resolved
@Michaelvll Michaelvll requested a review from cblmemo May 28, 2024 01:45
Copy link
Collaborator

@cblmemo cblmemo left a comment

Choose a reason for hiding this comment

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

Thanks for adding this feature @Michaelvll ! LGTM 🚀

@Michaelvll Michaelvll merged commit ef2b408 into master May 28, 2024
20 checks passed
@Michaelvll Michaelvll deleted the test-for-logs branch May 28, 2024 03:35
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.

[Jobs] sky jobs logs failed to show status spinner when the job is starting
2 participants