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

[Jobs] Add job submission ID to get_runtime_context() #28089

Open
architkulkarni opened this issue Aug 24, 2022 · 7 comments
Open

[Jobs] Add job submission ID to get_runtime_context() #28089

architkulkarni opened this issue Aug 24, 2022 · 7 comments
Labels
enhancement Request for new feature and/or capability P2 Important issue, but not time-critical
Milestone

Comments

@architkulkarni
Copy link
Contributor

Description

Add an API like the existing API ray.runtime_context.get_runtime_context().get_job_id(), but for the job submission ID.

Use case

The use case is for job driver code to read its job submission ID at runtime. e.g. to save job related artifacts to a remote registry with a separate folder for each job submission id and allow easy artifact retrieval just by the id.

@architkulkarni architkulkarni added enhancement Request for new feature and/or capability P2 Important issue, but not time-critical labels Aug 24, 2022
@GuillaumeDesforges
Copy link
Contributor

GuillaumeDesforges commented Nov 30, 2022

From Huaiwei Sun on Slack

To clarify, there are two job-related ids:

  • job id. Example: 02000000. This is available for all the ray jobs (whether you run it via ray client or job api).
  • job submission id. Example: raysubmit_7VLKtzTp2ZUVsmAc. This is available only for jobs submitted via job API for now

@scottsun94
Copy link
Contributor

@architkulkarni To avoid potential confusion,
We probably should haveray.runtime_context.get_runtime_context().get_job_submission_id() for submission id and ray.runtime_context.get_runtime_context().get_job_id() for job id?

@architkulkarni
Copy link
Contributor Author

Sure, that API makes sense.

@DhavalRepo18
Copy link

@architkulkarni any timeline?

@sfriedowitz
Copy link

Is it possible to get the submission_id in any way from the running job?

@scottsun94
Copy link
Contributor

cc: @akshay-anyscale for awareness

@allenwang28
Copy link
Contributor

One simple way to approach this:

import ray
from ray.job_submission import JobSubmissionClient


def get_job_submission_id() -> str:
    c = JobSubmissionClient()
    current_job_id = ray.get_runtime_context().get_job_id()
    jobs = c.list_jobs()
    return [job.submission_id for job in jobs if job.job_id == current_job_id][0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for new feature and/or capability P2 Important issue, but not time-critical
Projects
None yet
Development

No branches or pull requests

6 participants