-
Notifications
You must be signed in to change notification settings - Fork 633
[Spot/UX] Print spot jobs' resources before confirmation #2524
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No 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? No Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Left some nits 🫡
sky/task.py
Outdated
self.estimated_inputs_size_gigabytes = None | ||
self.estimated_outputs_size_gigabytes = None | ||
self.estimated_inputs_size_gigabytes = 0.0 | ||
self.estimated_outputs_size_gigabytes = 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why changing these values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is because we use the value in the optimizer, but not correctly handle None
. I changed the handling in the Optimizer instead. Thanks for catching this.
Co-authored-by: Tian Xia <cblmemo@gmail.com>
…ypilot into print-resources-for-spot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just some nits ; )
@@ -423,7 +424,7 @@ def from_yaml(yaml_path: str) -> 'Task': | |||
ValueError: if the path gets loaded into a str instead of a dict; or | |||
if there are any other parsing errors. | |||
""" | |||
with open(os.path.expanduser(yaml_path), 'r') as f: | |||
with open(os.path.expanduser(yaml_path), 'r', encoding='utf-8') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change encoding here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to always specify the encoding in open
function. We did not change the encoding, but just use the default utf-8
. https://peps.python.org/pep-0597/
@@ -44,7 +45,7 @@ | |||
'a list of node ip addresses (List[str]). Got {run_sig}') | |||
|
|||
|
|||
def _is_valid_name(name: str) -> bool: | |||
def _is_valid_name(name: Optional[str]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little bit curious why it could pass mypy check previously... Maybe we should file an issue to add type notation for these task-related functions? A lof of function still doesn't have a notation, like estimate_runtime
or get_resources
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should. Mypy will ignore the functions/variables without type annotation, so probably skip some callers with name that is None.
self.estimated_inputs_size_gigabytes = None | ||
self.estimated_outputs_size_gigabytes = None | ||
self.inputs: Optional[str] = None | ||
self.outputs: Optional[str] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe type notation for set_outputs
and get_outputs
too? Since it is relevant to this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Added. Thanks!
Before this PR launching a spot job will not show any information about the resources used by the spot job.

After this PR, the chosen resources for the spot job will be shown before confirmation.

Tested (run the relevant ones):
bash format.sh
pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
bash tests/backward_comaptibility_tests.sh