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

Mods to run from Modal #3908

Merged
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d69848a
Update command_runner.py
sethkimmel3 Sep 3, 2024
df30ac7
Update command_runner.py
sethkimmel3 Sep 3, 2024
8d93356
Update wheel_utils.py
sethkimmel3 Sep 3, 2024
f27df54
Update command_runner.py
sethkimmel3 Sep 3, 2024
5be67a7
Merge branch 'skypilot-org:master' into sethkimmel3-modify-ssh-contro…
sethkimmel3 Sep 5, 2024
df2bc33
Merge branch 'skypilot-org:master' into sethkimmel3-modify-ssh-contro…
sethkimmel3 Sep 9, 2024
b69c583
Merge branch 'skypilot-org:master' into sethkimmel3-modify-ssh-contro…
sethkimmel3 Sep 20, 2024
7c57122
Update wheel_utils.py
sethkimmel3 Sep 20, 2024
dab6ab3
Update wheel_utils.py
sethkimmel3 Sep 20, 2024
d1b7b67
Update command_runner.py
sethkimmel3 Sep 20, 2024
fb1b621
Update command_runner.py
sethkimmel3 Sep 20, 2024
9395450
Update command_runner.py
sethkimmel3 Sep 20, 2024
03d9c32
Update command_runner.py
sethkimmel3 Sep 20, 2024
1805834
Update command_runner.py
sethkimmel3 Sep 20, 2024
c60a5b5
Update command_runner.py
sethkimmel3 Sep 20, 2024
a24b2df
Update command_runner.py
sethkimmel3 Sep 20, 2024
5de6aee
Update command_runner.py
sethkimmel3 Sep 20, 2024
e278cab
Update command_runner.py
sethkimmel3 Sep 22, 2024
272f6ef
Update command_runner.py
sethkimmel3 Sep 22, 2024
f234c5b
Update wheel_utils.py
sethkimmel3 Sep 22, 2024
0ff8ba1
Update wheel_utils.py
sethkimmel3 Sep 22, 2024
4246672
Update wheel_utils.py
sethkimmel3 Sep 22, 2024
ed4570f
Update command_runner.py
sethkimmel3 Sep 23, 2024
6ab5f31
Update wheel_utils.py
sethkimmel3 Sep 23, 2024
0c8205f
Update wheel_utils.py
sethkimmel3 Sep 23, 2024
c4c7c2c
Update wheel_utils.py
sethkimmel3 Sep 23, 2024
a9fff3c
Update wheel_utils.py
sethkimmel3 Sep 23, 2024
ff9b36a
Update wheel_utils.py
sethkimmel3 Sep 23, 2024
7aa32ee
Update wheel_utils.py
sethkimmel3 Sep 23, 2024
a22c884
Merge branch 'skypilot-org:master' into sethkimmel3-modify-ssh-contro…
sethkimmel3 Sep 30, 2024
48fe52b
Merge branch 'skypilot-org:master' into sethkimmel3-modify-ssh-contro…
sethkimmel3 Oct 17, 2024
6120952
Create control_master_checks.py
sethkimmel3 Oct 27, 2024
63c7eb1
Update command_runner.py
sethkimmel3 Oct 27, 2024
36dcbcb
Update wheel_utils.py
sethkimmel3 Oct 27, 2024
f288ebe
Merge branch 'skypilot-org:master' into sethkimmel3-modify-ssh-contro…
sethkimmel3 Oct 27, 2024
5d04ba8
fix import
sethkimmel3 Oct 27, 2024
e1793be
fix some pylint stuff
sethkimmel3 Oct 27, 2024
468cf51
more pylint
sethkimmel3 Oct 28, 2024
742875a
more pylint
sethkimmel3 Oct 28, 2024
3613c38
more pylint
sethkimmel3 Oct 28, 2024
7a1bdc3
yapf'
sethkimmel3 Oct 28, 2024
dfd6e33
reorder imports
sethkimmel3 Oct 28, 2024
0386507
fix
sethkimmel3 Oct 28, 2024
e57714c
updates from PR comments
sethkimmel3 Nov 8, 2024
2ed568f
formatting
sethkimmel3 Nov 8, 2024
29c4b46
fix
sethkimmel3 Nov 8, 2024
75aa402
dummy
sethkimmel3 Nov 8, 2024
dfb501a
fix subprocess command
sethkimmel3 Nov 8, 2024
0581e15
more changes
sethkimmel3 Nov 8, 2024
68b005d
fix
sethkimmel3 Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sky/backends/wheel_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ def _build_sky_wheel() -> pathlib.Path:

wheel_dir = WHEEL_DIR / hash_of_latest_wheel
wheel_dir.mkdir(parents=True, exist_ok=True)
shutil.move(str(wheel_path), wheel_dir)
# shutil.move will fail when the file already exists and is being
# moved across filesystems.
if not os.path.exists(
os.path.join(wheel_dir, os.path.basename(wheel_path))):
shutil.move(str(wheel_path), wheel_dir)
Comment on lines +134 to +136
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a comment for in what case this will not exist? Or should we remove this change for this PR?

return wheel_dir / wheel_path.name


Expand Down
5 changes: 4 additions & 1 deletion sky/utils/command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from sky.skylet import constants
from sky.skylet import log_lib
from sky.utils import common_utils
from sky.utils import control_master_checks
from sky.utils import subprocess_utils
from sky.utils import timeline

Expand Down Expand Up @@ -442,7 +443,9 @@ def __init__(
None if ssh_control_name is None else hashlib.md5(
ssh_control_name.encode()).hexdigest()[:_HASH_MAX_LENGTH])
self._ssh_proxy_command = ssh_proxy_command
self.disable_control_master = disable_control_master
self.disable_control_master = (
disable_control_master or
control_master_checks.should_disable_control_master())
if docker_user is not None:
assert port is None or port == 22, (
f'port must be None or 22 for docker_user, got {port}.')
Expand Down
49 changes: 49 additions & 0 deletions sky/utils/control_master_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Utils to check if the ssh control master should be disabled."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would prefer renaming it to control_master_utils.py


from functools import lru_cache

from sky import sky_logging
from sky.utils import subprocess_utils

logger = sky_logging.init_logger(__name__)


def is_tmp_9p_filesystem() -> bool:
"""Check if the /tmp filesystem is 9p.

Returns:
bool: True if the /tmp filesystem is 9p, False otherwise.
"""

result = subprocess_utils.run(['df', '-T', '/tmp'],
capture_output=True,
text=True,
shell=None,
check=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
check=None,
check=False,

executable=None)

if result.returncode != 0:
return False

filesystem_infos = result.stdout.strip().split('\n')
if len(filesystem_infos) < 2:
return False
filesystem_types = filesystem_infos[1].split()
if len(filesystem_types) < 2:
return False
return filesystem_types[1].lower() == '9p'


@lru_cache
Copy link
Collaborator

Choose a reason for hiding this comment

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

style: import module instead of functions

Suggested change
@lru_cache
@functools.lru_cache

def should_disable_control_master() -> bool:
"""Whether disable ssh control master based on file system.

Returns:
bool: True if the ssh control master should be disabled,
False otherwise.
"""
if is_tmp_9p_filesystem():
return True
# there may be additional criteria to disable ssh control master
# in the future. They should be checked here
return False
Loading