Skip to content

Commit 0ab39bd

Browse files
authored
[ML] Add docstrings to JobService class (Azure#28599)
* [ML] Add docstrings to JobService class
1 parent 9b1d5c3 commit 0ab39bd

File tree

2 files changed

+101
-2
lines changed

2 files changed

+101
-2
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 1.4.0 (Unreleased)
44

55
### Features Added
6-
-Add dedicated classes for each type of job service. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
6+
- Added dedicated classes for each type of job service and updated the docstrings. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
77

88
### Bugs Fixed
99
- Fixed an issue where the ordering of `.amlignore` and `.gitignore` files are not respected

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job_service.py

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
@experimental
2121
class JobServiceBase(RestTranslatableMixin):
22-
"""JobService configuration.
22+
"""Base class for job service configuration.
2323
2424
:param endpoint: Url for endpoint.
2525
:type endpoint: str
@@ -35,6 +35,8 @@ class JobServiceBase(RestTranslatableMixin):
3535
:type properties: dict[str, str]
3636
:param status: Status of endpoint.
3737
:type status: str
38+
:param kwargs: A dictionary of additional configuration parameters.
39+
:type kwargs: dict
3840
"""
3941

4042
def __init__(
@@ -148,6 +150,27 @@ def _from_rest_job_services(
148150

149151
@experimental
150152
class JobService(JobServiceBase):
153+
"""Basic job service configuration for backward compatibility.
154+
Use JupyterLabJobService, SshJobService, TensorBoardJobService or VsCodeJobService
155+
specific to your job type instead of JobService.
156+
157+
:param endpoint: Url for endpoint.
158+
:type endpoint: str
159+
:param job_service_type: Endpoint type.
160+
Accepts "jupyter_lab", "ssh", "tensor_board", "vs_code"
161+
:type job_service_type: str
162+
:param port: Port for endpoint.
163+
:type nodes: str
164+
:param nodes: Indicates whether the service has to run in all nodes.
165+
:type port: int
166+
:param properties: Additional properties to set on the endpoint.
167+
:type properties: dict[str, str]
168+
:param status: Status of endpoint.
169+
:type status: str
170+
:param kwargs: A dictionary of additional configuration parameters.
171+
:type kwargs: dict
172+
"""
173+
151174
@classmethod
152175
def _from_rest_object(cls, obj: RestJobService) -> "JobService":
153176
return cls._from_rest_job_service_object(obj)
@@ -158,6 +181,26 @@ def _to_rest_object(self) -> RestJobService:
158181

159182
@experimental
160183
class SshJobService(JobServiceBase):
184+
"""SSH job service configuration.
185+
186+
:param endpoint: Url for endpoint.
187+
:type endpoint: str
188+
:param port: Port for endpoint.
189+
:type nodes: str
190+
:param nodes: Indicates whether the service has to run in all nodes.
191+
:type port: int
192+
:param properties: Additional properties to set on the endpoint.
193+
:type properties: dict[str, str]
194+
:param status: Status of endpoint.
195+
:type status: str
196+
:param ssh_public_keys: SSH Public Key to access job container via SSH.
197+
:type ssh_public_keys: str
198+
:param kwargs: A dictionary of additional configuration parameters.
199+
:type kwargs: dict
200+
:ivar job_service_type: Specifies the type of job service. Set automatically to "ssh" for this class.
201+
:vartype type: str
202+
"""
203+
161204
def __init__(
162205
self,
163206
*,
@@ -193,6 +236,26 @@ def _to_rest_object(self) -> RestJobService:
193236

194237
@experimental
195238
class TensorBoardJobService(JobServiceBase):
239+
"""TensorBoard job service configuration.
240+
241+
:param endpoint: Url for endpoint.
242+
:type endpoint: str
243+
:param port: Port for endpoint.
244+
:type nodes: str
245+
:param nodes: Indicates whether the service has to run in all nodes.
246+
:type port: int
247+
:param properties: Additional properties to set on the endpoint.
248+
:type properties: dict[str, str]
249+
:param status: Status of endpoint.
250+
:type status: str
251+
:param log_dir: Log directory path.
252+
:type log_dir: str
253+
:param kwargs: A dictionary of additional configuration parameters.
254+
:type kwargs: dict
255+
:ivar job_service_type: Specifies the type of job service. Set automatically to "tensor_board" for this class.
256+
:vartype type: str
257+
"""
258+
196259
def __init__(
197260
self,
198261
*,
@@ -228,6 +291,24 @@ def _to_rest_object(self) -> RestJobService:
228291

229292
@experimental
230293
class JupyterLabJobService(JobServiceBase):
294+
"""JupyterLab job service configuration.
295+
296+
:param endpoint: Url for endpoint.
297+
:type endpoint: str
298+
:param port: Port for endpoint.
299+
:type nodes: str
300+
:param nodes: Indicates whether the service has to run in all nodes.
301+
:type port: int
302+
:param properties: Additional properties to set on the endpoint.
303+
:type properties: dict[str, str]
304+
:param status: Status of endpoint.
305+
:type status: str
306+
:param kwargs: A dictionary of additional configuration parameters.
307+
:type kwargs: dict
308+
:ivar job_service_type: Specifies the type of job service. Set automatically to "jupyter_lab" for this class.
309+
:vartype type: str
310+
"""
311+
231312
def __init__(
232313
self,
233314
*,
@@ -258,6 +339,24 @@ def _to_rest_object(self) -> RestJobService:
258339

259340
@experimental
260341
class VsCodeJobService(JobServiceBase):
342+
"""VS Code job service configuration.
343+
344+
:param endpoint: Url for endpoint.
345+
:type endpoint: str
346+
:param port: Port for endpoint.
347+
:type nodes: str
348+
:param nodes: Indicates whether the service has to run in all nodes.
349+
:type port: int
350+
:param properties: Additional properties to set on the endpoint.
351+
:type properties: dict[str, str]
352+
:param status: Status of endpoint.
353+
:type status: str
354+
:param kwargs: A dictionary of additional configuration parameters.
355+
:type kwargs: dict
356+
:ivar job_service_type: Specifies the type of job service. Set automatically to "vs_code" for this class.
357+
:vartype type: str
358+
"""
359+
261360
def __init__(
262361
self,
263362
*,

0 commit comments

Comments
 (0)