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

[Spot] Add spot job name in the SKYPILOT_TASK_ID env var #3424

Merged
merged 25 commits into from
Apr 5, 2024

Conversation

Michaelvll
Copy link
Collaborator

@Michaelvll Michaelvll commented Apr 5, 2024

Fixes #3391

This PR adds the task name in the SKYPILOT_TASK_ID.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
    • sky spot launch -n test "echo \$SKYPILOT_TASK_ID" --cpus 2
      sky-managed-2024-04-05-17-47-48-461038_test_14-0
      
    • sky launch -c my-clus -n test "echo \$SKYPILOT_TASK_ID" --cpus 2
      sky-2024-04-05-17-12-35-855707_my-clus_1
      
  • 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

Copy link
Member

@concretevitamin concretevitamin left a comment

Choose a reason for hiding this comment

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

Thanks @Michaelvll, some questions.

docs/source/examples/spot-jobs.rst Outdated Show resolved Hide resolved
docs/source/examples/spot-jobs.rst Show resolved Hide resolved
docs/source/examples/spot-jobs.rst Outdated Show resolved Hide resolved
.. note::

The :code:`$SKYPILOT_TASK_ID` environment variable is also available in the :code:`run` section of each task. It is unique for each task in the pipeline.
For the :code:`eval` task, the :code:`$SKYPILOT_TASK_ID` will be:
Copy link
Member

Choose a reason for hiding this comment

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

One UX discussion: I found myself reading these as "spot_id". Took a while to realize that it should be read as "_spot" and appended with "id-xxxx". Shall we skip the _id part if backward compatible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, it should be read as spot_id and appended with _<job_id>-<task_id>. I guess there will be no significant backward compatibility error in the case. I am not strongly for keeping the id or not. Wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, reason I found "spot_id" odd is that typically we can just append the IDs without saying IDs first. (E.g., we prepend the timestamp without saying timestamp-.)

In this case, how about we remove -id? I guess moving spot-id as a whole may be less desirable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We do have an _id for normal cluster job. To keep it align, we may have to remove it for those jobs as well.
Removed is for both now.

docs/source/running-jobs/environment-variables.rst Outdated Show resolved Hide resolved
.. note::

The :code:`$SKYPILOT_TASK_ID` environment variable is also available in the :code:`run` section of each task. It is unique for each task in the pipeline.
For the :code:`eval` task, the :code:`$SKYPILOT_TASK_ID` will be:
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, reason I found "spot_id" odd is that typically we can just append the IDs without saying IDs first. (E.g., we prepend the timestamp without saying timestamp-.)

In this case, how about we remove -id? I guess moving spot-id as a whole may be less desirable.

@Michaelvll
Copy link
Collaborator Author

Michaelvll commented Apr 5, 2024

I updated the naming of $SKYPILOT_TASK_ID (as shown in description), and added it for the setup section if the job is submitted with --detach-setup or sky spot launch. PTAL @concretevitamin

Copy link
Member

@concretevitamin concretevitamin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @Michaelvll.

docs/source/examples/spot-jobs.rst Outdated Show resolved Hide resolved
docs/source/running-jobs/environment-variables.rst Outdated Show resolved Hide resolved
@Michaelvll Michaelvll merged commit 48b8ca9 into master Apr 5, 2024
20 checks passed
@Michaelvll Michaelvll deleted the task-name-in-id branch April 5, 2024 19:37
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.

[Spot/UX] Make spot job name part of SKYPILOT_TASK_ID
2 participants