Skip to content

Commit 073b171

Browse files
Added descriptions for parameters passed in methods
1 parent e85fe63 commit 073b171

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/codeflare_sdk/job/ray_jobs.py

+23-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@
1717
The SDK acts as a wrapper for the Ray Job Submission Client.
1818
"""
1919
from ray.job_submission import JobSubmissionClient
20-
from typing import Iterator, Optional, Dict, Any, Union
20+
from ray.dashboard.modules.job.pydantic_models import JobDetails
21+
from typing import Iterator, Optional, Dict, Any, Union, List
2122

2223

2324
class RayJobClient:
2425
"""
25-
An object for that acts as the Ray Job Submission Client.
26+
A class that functions as a wrapper for the Ray Job Submission Client.
27+
28+
parameters:
29+
address -- Either (1) the address of the Ray cluster, or (2) the HTTP address of the dashboard server on the head node, e.g. “http://<head-node-ip>:8265”. In case (1) it must be specified as an address that can be passed to ray.init(),
30+
e.g. a Ray Client address (ray://<head_node_host>:10001), or “auto”, or “localhost:<port>”. If unspecified, will try to connect to a running local Ray cluster. This argument is always overridden by the RAY_ADDRESS environment variable.
31+
create_cluster_if_needed -- Indicates whether the cluster at the specified address needs to already be running. Ray doesn't start a cluster before interacting with jobs, but third-party job managers may do so.
32+
cookies -- Cookies to use when sending requests to the HTTP job server.
33+
metadata -- Arbitrary metadata to store along with all jobs. New metadata specified per job will be merged with the global metadata provided here via a simple dict update.
34+
headers -- Headers to use when sending requests to the HTTP job server, used for cases like authentication to a remote cluster.
35+
verify -- Boolean indication to verify the server's TLS certificate or a path to a file or directory of trusted certificates. Default: True.
2636
"""
2737

2838
def __init__(
@@ -56,6 +66,16 @@ def submit_job(
5666
) -> str:
5767
"""
5868
Method for submitting jobs to a Ray Cluster and returning the job id with entrypoint being a mandatory field.
69+
70+
Parameters:
71+
entrypoint -- The shell command to run for this job.
72+
submission_id -- A unique ID for this job.
73+
runtime_env -- The runtime environment to install and run this job in.
74+
metadata -- Arbitrary data to store along with this job.
75+
job_id -- DEPRECATED. This has been renamed to submission_id
76+
entrypoint_num_cpus -- The quantity of CPU cores to reserve for the execution of the entrypoint command, separately from any tasks or actors launched by it. Defaults to 0.
77+
entrypoint_num_gpus -- The quantity of GPUs to reserve for the execution of the entrypoint command, separately from any tasks or actors launched by it. Defaults to 0.
78+
entrypoint_resources -- The quantity of custom resources to reserve for the execution of the entrypoint command, separately from any tasks or actors launched by it.
5979
"""
6080
return self.rayJobClient.submit_job(
6181
entrypoint=entrypoint,
@@ -105,7 +125,7 @@ def get_job_status(self, job_id: str) -> str:
105125
"""
106126
return self.rayJobClient.get_job_status(job_id=job_id)
107127

108-
def list_jobs(self):
128+
def list_jobs(self) -> List[JobDetails]:
109129
"""
110130
Method for getting a list of current jobs in the Ray Cluster.
111131
"""

0 commit comments

Comments
 (0)