Skip to content

Commit 654542e

Browse files
committed
Update infrastructure config example code.
1 parent d142609 commit 654542e

File tree

11 files changed

+140
-83
lines changed

11 files changed

+140
-83
lines changed

docs/source/user_guide/jobs/infra_and_runtime.rst

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,7 @@ Infrastructure
1818
The Data Science Job infrastructure is defined by a :py:class:`~ads.jobs.DataScienceJob` instance.
1919
For example:
2020

21-
.. code-block:: python3
22-
23-
from ads.jobs import DataScienceJob
24-
25-
infrastructure = (
26-
DataScienceJob()
27-
.with_compartment_id("<compartment_ocid>")
28-
.with_project_id("<project_ocid>")
29-
.with_subnet_id("<subnet_ocid>")
30-
.with_shape_name("VM.Standard.E3.Flex")
31-
# Shape config details are applicable only for the flexible shapes.
32-
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
33-
# Minimum block storage size is 50 (GB)
34-
.with_block_storage_size(50)
35-
.with_log_group_id("<log_group_ocid>")
36-
.with_log_id("<log_ocid>")
37-
)
21+
.. include:: ../jobs/tabs/infra_config.rst
3822

3923
When creating a :py:class:`~ads.jobs.DataScienceJob` instance, the following configurations are required:
4024

@@ -55,11 +39,21 @@ Using Configurations from Notebook
5539

5640
If you are creating a job from an OCI Data Science
5741
`Notebook Session <https://docs.oracle.com/en-us/iaas/data-science/using/manage-notebook-sessions.htm>`_,
58-
the same infrastructure configurations from the notebook session will be used as defaults.
42+
the same infrastructure configurations from the notebook session will be used as defaults, including:
43+
44+
* Compartment ID
45+
* Project ID
46+
* Subnet ID
47+
* Compute Shape
48+
* Block Storage Size
49+
5950
You can initialize the :py:class:`~ads.jobs.DataScienceJob`
6051
with the logging configurations and override the other options as needed. For example:
6152

62-
.. code-block:: python3
53+
.. tabs::
54+
55+
.. code-tab:: python
56+
:caption: Python
6357

6458
from ads.jobs import DataScienceJob
6559

@@ -69,11 +63,22 @@ with the logging configurations and override the other options as needed. For ex
6963
.with_log_id("<log_ocid>")
7064
# Use a GPU shape for the job,
7165
# regardless of the shape used by the notebook session
72-
.with_shape_name("VM.GPU2.1")
66+
.with_shape_name("VM.GPU3.1")
7367
# compartment ID, project ID, subnet ID and block storage will be
7468
# the same as the ones set in the notebook session
7569
)
7670

71+
.. code-tab:: yaml
72+
:caption: YAML
73+
74+
kind: infrastructure
75+
type: dataScienceJob
76+
spec:
77+
logGroupId: <log_group_ocid>
78+
logId: <log_ocid>
79+
shapeName: VM.GPU3.1
80+
81+
7782
Compute Shapes
7883
--------------
7984

@@ -136,7 +141,7 @@ Environment variables enclosed by ``${...}`` will be substituted. For example:
136141

137142
.. include:: ../jobs/tabs/runtime_envs.rst
138143

139-
.. code-block:: python3
144+
.. code-block:: python
140145
141146
for k, v in runtime.environment_variables.items():
142147
print(f"{k}: {v}")

docs/source/user_guide/jobs/tabs/container_runtime.rst

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
from ads.jobs import Job, DataScienceJob, ContainerRuntime
77

88
job = (
9-
Job(name="My Job")
10-
.with_infrastructure(
11-
DataScienceJob()
12-
.with_log_group_id("<log_group_ocid>")
13-
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
17-
.with_compartment_id("<compartment_ocid>")
18-
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
20-
.with_subnet_id("<subnet_ocid>")
21-
.with_shape_name("VM.Standard.E3.Flex")
22-
# Shape config details are applicable only for the flexible shapes.
23-
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
24-
.with_block_storage_size(50)
25-
)
26-
.with_runtime(
27-
ContainerRuntime()
28-
.with_image("<region>.ocir.io/<your_tenancy>/<your_image>")
29-
.with_environment_variable(GREETINGS="Welcome to OCI Data Science")
30-
.with_entrypoint(["/bin/sh", "-c"])
31-
.with_cmd("sleep 5 && echo $GREETINGS")
32-
)
9+
Job(name="My Job")
10+
.with_infrastructure(
11+
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
13+
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
15+
.with_log_id("<log_ocid>")
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
19+
.with_compartment_id("<compartment_ocid>")
20+
.with_project_id("<project_ocid>")
21+
.with_subnet_id("<subnet_ocid>")
22+
.with_shape_name("VM.Standard.E3.Flex")
23+
# Shape config details are applicable only for the flexible shapes.
24+
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
26+
.with_block_storage_size(50)
27+
)
28+
.with_runtime(
29+
ContainerRuntime()
30+
.with_image("<region>.ocir.io/<your_tenancy>/<your_image>")
31+
.with_environment_variable(GREETINGS="Welcome to OCI Data Science")
32+
.with_entrypoint(["/bin/sh", "-c"])
33+
.with_cmd("sleep 5 && echo $GREETINGS")
34+
)
3335
)
3436

3537
.. code-tab:: yaml
@@ -45,7 +47,6 @@
4547
blockStorageSize: 50
4648
compartmentId: <compartment_ocid>
4749
jobInfrastructureType: STANDALONE
48-
jobType: DEFAULT
4950
logGroupId: <log_group_ocid>
5051
logId: <log_ocid>
5152
projectId: <project_ocid>

docs/source/user_guide/jobs/tabs/git_notebook.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
Job(name="My Job")
1010
.with_infrastructure(
1111
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
1213
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
1315
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
1719
.with_compartment_id("<compartment_ocid>")
1820
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
2021
.with_subnet_id("<subnet_ocid>")
2122
.with_shape_name("VM.Standard.E3.Flex")
2223
# Shape config details are applicable only for the flexible shapes.
2324
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
2426
.with_block_storage_size(50)
2527
)
2628
.with_runtime(
@@ -47,7 +49,6 @@
4749
blockStorageSize: 50
4850
compartmentId: <compartment_ocid>
4951
jobInfrastructureType: STANDALONE
50-
jobType: DEFAULT
5152
logGroupId: <log_group_ocid>
5253
logId: <log_ocid>
5354
projectId: <project_ocid>

docs/source/user_guide/jobs/tabs/git_runtime.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
Job(name="My Job")
1010
.with_infrastructure(
1111
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
1213
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
1315
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
1719
.with_compartment_id("<compartment_ocid>")
1820
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
2021
.with_subnet_id("<subnet_ocid>")
2122
.with_shape_name("VM.Standard.E3.Flex")
2223
# Shape config details are applicable only for the flexible shapes.
2324
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
2426
.with_block_storage_size(50)
2527
)
2628
.with_runtime(
@@ -54,7 +56,6 @@
5456
blockStorageSize: 50
5557
compartmentId: <compartment_ocid>
5658
jobInfrastructureType: STANDALONE
57-
jobType: DEFAULT
5859
logGroupId: <log_group_ocid>
5960
logId: <log_ocid>
6061
projectId: <project_ocid>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. tabs::
2+
3+
.. code-tab:: python
4+
:caption: Python
5+
6+
from ads.jobs import Job, DataScienceJob, GitPythonRuntime
7+
8+
infrastructure = (
9+
DataScienceJob()
10+
# Configure logging for getting the job run outputs.
11+
.with_log_group_id("<log_group_ocid>")
12+
# Log resource will be auto-generated if log ID is not specified.
13+
.with_log_id("<log_ocid>")
14+
# If you are in an OCI data science notebook session,
15+
# the following configurations are not required.
16+
# Configurations from the notebook session will be used as defaults.
17+
.with_compartment_id("<compartment_ocid>")
18+
.with_project_id("<project_ocid>")
19+
.with_subnet_id("<subnet_ocid>")
20+
.with_shape_name("VM.Standard.E3.Flex")
21+
# Shape config details are applicable only for the flexible shapes.
22+
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
23+
# Minimum/Default block storage size is 50 (GB).
24+
.with_block_storage_size(50)
25+
)
26+
27+
.. code-tab:: yaml
28+
:caption: YAML
29+
30+
kind: infrastructure
31+
type: dataScienceJob
32+
spec:
33+
blockStorageSize: 50
34+
compartmentId: <compartment_ocid>
35+
logGroupId: <log_group_ocid>
36+
logId: <log_ocid>
37+
projectId: <project_ocid>
38+
shapeConfigDetails:
39+
memoryInGBs: 16
40+
ocpus: 1
41+
shapeName: VM.Standard.E3.Flex
42+
subnetId: <subnet_ocid>

docs/source/user_guide/jobs/tabs/name_substitution.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
type: dataScienceJob
3737
spec:
3838
compartmentId: <compartment_ocid>
39-
jobType: DEFAULT
4039
logGroupId: <log_group_ocid>
4140
logId: <log_ocid>
4241
projectId: <project_ocid>

docs/source/user_guide/jobs/tabs/notebook_runtime.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
Job(name="My Job")
1010
.with_infrastructure(
1111
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
1213
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
1315
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
1719
.with_compartment_id("<compartment_ocid>")
1820
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
2021
.with_subnet_id("<subnet_ocid>")
2122
.with_shape_name("VM.Standard.E3.Flex")
2223
# Shape config details are applicable only for the flexible shapes.
2324
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
2426
.with_block_storage_size(50)
2527
)
2628
.with_runtime(
@@ -49,7 +51,6 @@
4951
blockStorageSize: 50
5052
compartmentId: <compartment_ocid>
5153
jobInfrastructureType: STANDALONE
52-
jobType: DEFAULT
5354
logGroupId: <log_group_ocid>
5455
logId: <log_ocid>
5556
projectId: <project_ocid>

docs/source/user_guide/jobs/tabs/python_runtime.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
Job(name="My Job")
1010
.with_infrastructure(
1111
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
1213
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
1315
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
1719
.with_compartment_id("<compartment_ocid>")
1820
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
2021
.with_subnet_id("<subnet_ocid>")
2122
.with_shape_name("VM.Standard.E3.Flex")
2223
# Shape config details are applicable only for the flexible shapes.
2324
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
2426
.with_block_storage_size(50)
2527
)
2628
.with_runtime(
@@ -61,7 +63,6 @@
6163
blockStorageSize: 50
6264
compartmentId: <compartment_ocid>
6365
jobInfrastructureType: STANDALONE
64-
jobType: DEFAULT
6566
logGroupId: <log_group_ocid>
6667
logId: <log_ocid>
6768
projectId: <project_ocid>

docs/source/user_guide/jobs/tabs/quick_start_job.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
Job(name="My Job")
1010
.with_infrastructure(
1111
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
1213
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
1315
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
1719
.with_compartment_id("<compartment_ocid>")
1820
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
2021
.with_subnet_id("<subnet_ocid>")
2122
.with_shape_name("VM.Standard.E3.Flex")
2223
# Shape config details are applicable only for the flexible shapes.
2324
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
2426
.with_block_storage_size(50)
2527
)
2628
.with_runtime(
@@ -49,7 +51,6 @@
4951
blockStorageSize: 50
5052
compartmentId: <compartment_ocid>
5153
jobInfrastructureType: STANDALONE
52-
jobType: DEFAULT
5354
logGroupId: <log_group_ocid>
5455
logId: <log_ocid>
5556
projectId: <project_ocid>

docs/source/user_guide/jobs/tabs/script_runtime.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
Job(name="My Job")
1010
.with_infrastructure(
1111
DataScienceJob()
12+
# Configure logging for getting the job run outputs.
1213
.with_log_group_id("<log_group_ocid>")
14+
# Log resource will be auto-generated if log ID is not specified.
1315
.with_log_id("<log_ocid>")
14-
# The following infrastructure configurations are optional
15-
# if you are in an OCI data science notebook session.
16-
# The configurations of the notebook session will be used as defaults.
16+
# If you are in an OCI data science notebook session,
17+
# the following configurations are not required.
18+
# Configurations from the notebook session will be used as defaults.
1719
.with_compartment_id("<compartment_ocid>")
1820
.with_project_id("<project_ocid>")
19-
# For default networking, no need to specify subnet ID
2021
.with_subnet_id("<subnet_ocid>")
2122
.with_shape_name("VM.Standard.E3.Flex")
2223
# Shape config details are applicable only for the flexible shapes.
2324
.with_shape_config_details(memory_in_gbs=16, ocpus=1)
25+
# Minimum/Default block storage size is 50 (GB).
2426
.with_block_storage_size(50)
2527
)
2628
.with_runtime(
@@ -53,7 +55,6 @@
5355
blockStorageSize: 50
5456
compartmentId: <compartment_ocid>
5557
jobInfrastructureType: STANDALONE
56-
jobType: DEFAULT
5758
logGroupId: <log_group_ocid>
5859
logId: <log_ocid>
5960
projectId: <project_ocid>

0 commit comments

Comments
 (0)