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

[Jobs] Allow logs for finished jobs and add sky jobs logs --refresh for restartin jobs controller #4380

Merged
merged 13 commits into from
Dec 3, 2024

Conversation

Michaelvll
Copy link
Collaborator

@Michaelvll Michaelvll commented Nov 18, 2024

Currently, sky jobs logs does not work with finished jobs, although we do have the logs downloaded for failed jobs to the controller. We now enable sky jobs logs for all finished jobs, including succeeded ones.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
    • pytest tests/test_smoke.py --managed-jobs
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
    • pytest tests/test_smoke.py::test_env_check (with newly added --detach-setup test)
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@Michaelvll Michaelvll requested review from cblmemo and cg505 and removed request for cblmemo November 18, 2024 18:50
@Michaelvll Michaelvll changed the title [Jobs] Allow logs for finished jobs [Jobs] Allow logs for finished jobs and add sky jobs logs --refresh for restartin jobs controller Nov 18, 2024
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/controller.py Outdated Show resolved Hide resolved
sky/jobs/controller.py Show resolved Hide resolved
sky/jobs/core.py Outdated Show resolved Hide resolved
sky/jobs/state.py Show resolved Hide resolved
sky/jobs/state.py Outdated Show resolved Hide resolved
sky/utils/controller_utils.py Show resolved Hide resolved
Copy link
Collaborator

@cg505 cg505 left a comment

Choose a reason for hiding this comment

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

this seems super useful, thanks!

sky/jobs/state.py Outdated Show resolved Hide resolved

def get_local_log_file(job_id: int, task_id: Optional[int]) -> Optional[str]:
"""Get the local log directory for a job."""
task_str = '' if task_id is None else f' AND task_id={task_id}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines +387 to +394
# Stream the logs to the console without reading the whole
# file into memory.
start_streaming = False
for line in f:
if log_lib.LOG_FILE_START_STREAMING_AT in line:
start_streaming = True
if start_streaming:
print(line, end='', flush=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we move this into some utils file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! It may require a larger refactoring of the log_lib functions as well. Let's do it in a different PR. Added a TODO.

Copy link
Collaborator

@cg505 cg505 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 the fixes!

@Michaelvll Michaelvll added this pull request to the merge queue Dec 3, 2024
@Michaelvll Michaelvll removed this pull request from the merge queue due to a manual request Dec 3, 2024
@Michaelvll Michaelvll added this pull request to the merge queue Dec 3, 2024
Merged via the queue into master with commit 2157f01 Dec 3, 2024
19 checks passed
@Michaelvll Michaelvll deleted the logs-for-finished-jobs branch December 3, 2024 21:46
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.

3 participants