Skip to content

Commit

Permalink
Fix controller log
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed May 26, 2024
1 parent bf4dd55 commit a8ca38f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sky/jobs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
# The version of the lib files that jobs/utils use. Whenever there is an API
# change for the jobs/utils, we need to bump this version and update
# job.utils.ManagedJobCodeGen to handle the version update.
MANAGED_JOBS_VERSION = 2
MANAGED_JOBS_VERSION = 1
16 changes: 12 additions & 4 deletions sky/jobs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,11 +747,11 @@ class ManagedJobCodeGen:
_PREFIX = textwrap.dedent("""\
managed_job_version = 0
try:
from sky.jobs import constants, utils
from sky.jobs.utils import stream_logs_by_id
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
managed_job_version = constants.MANAGED_JOBS_VERSION
managed_job_version = managed_job_constants.MANAGED_JOBS_VERSION
except ImportError:
from sky.spot import spot_state as state, spot_utils as utils
""")
Expand Down Expand Up @@ -792,7 +792,15 @@ def stream_logs(cls,
# We inspect the source code of the function here for backward
# compatibility.
# TODO: change to utils.stream_logs(job_id, job_name, follow) in v0.8.0.
code = inspect.getsource(stream_logs)
# Import libraries required by `stream_logs`
code = textwrap.dedent("""\
import os
from sky.skylet import job_lib, log_lib
from sky.skylet import constants
from sky.jobs.utils import stream_logs_by_id
""")
code += inspect.getsource(stream_logs)
code += textwrap.dedent(f"""\
msg = stream_logs({job_id!r}, {job_name!r},
Expand Down

0 comments on commit a8ca38f

Please sign in to comment.