Skip to content

[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

Merged
merged 9 commits into from
Sep 10, 2023

Conversation

Michaelvll
Copy link
Collaborator

@Michaelvll Michaelvll commented Sep 7, 2023

Before this PR launching a spot job will not show any information about the resources used by the spot job.
image

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

image

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
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: bash tests/backward_comaptibility_tests.sh

@Michaelvll Michaelvll changed the title [Spot] Print spot jobs' resources before confirmation [Spot/UX] Print spot jobs' resources before confirmation Sep 7, 2023
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.

LGTM! Left some nits 🫡

sky/task.py Outdated
Comment on lines 228 to 229
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why changing these values?

Copy link
Collaborator Author

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>
@Michaelvll Michaelvll linked an issue Sep 8, 2023 that may be closed by this pull request
@Michaelvll Michaelvll requested a review from cblmemo September 9, 2023 21:29
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.

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:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why change encoding here?

Copy link
Collaborator Author

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:
Copy link
Collaborator

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.

Copy link
Collaborator Author

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
Copy link
Collaborator

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

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 call! Added. Thanks!

@Michaelvll Michaelvll merged commit c87052d into master Sep 10, 2023
@Michaelvll Michaelvll deleted the print-resources-for-spot branch September 10, 2023 05:14
No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UX] spot launch shows the cost of the controller, not the VM
2 participants