Skip to content

Commit 46da9a4

Browse files
committed
Add quick_start_job.rst
1 parent 3b153f2 commit 46da9a4

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
.. tabs::
2+
3+
.. code-tab:: python
4+
:caption: Python
5+
6+
from ads.jobs import Job, DataScienceJob, PythonRuntime
7+
8+
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+
PythonRuntime()
28+
# Specify the service conda environment by slug name.
29+
.with_service_conda("pytorch110_p38_cpu_v1")
30+
# Source code of the job, can be local or remote.
31+
.with_source("https://raw.githubusercontent.com/oracle-samples/oci-data-science-ai-samples/432357b123b7401ef67b116fe19aec217ca920f0/jobs/python/job%2Bsamples/greeting-env-cmd.py")
32+
# Environment variable
33+
.with_environment_variable(NAME="Welcome to OCI Data Science.")
34+
# Command line argument
35+
.with_argument(greeting="Good morning")
36+
)
37+
)
38+
39+
.. code-tab:: yaml
40+
:caption: YAML
41+
42+
kind: job
43+
spec:
44+
name: "My Job"
45+
infrastructure:
46+
kind: infrastructure
47+
type: dataScienceJob
48+
spec:
49+
blockStorageSize: 50
50+
compartmentId: <compartment_ocid>
51+
jobInfrastructureType: STANDALONE
52+
jobType: DEFAULT
53+
logGroupId: <log_group_ocid>
54+
logId: <log_ocid>
55+
projectId: <project_ocid>
56+
shapeConfigDetails:
57+
memoryInGBs: 16
58+
ocpus: 1
59+
shapeName: VM.Standard.E3.Flex
60+
subnetId: <subnet_ocid>
61+
runtime:
62+
kind: runtime
63+
type: python
64+
spec:
65+
args:
66+
- --greeting
67+
- Good morning
68+
conda:
69+
slug: pytorch110_p38_cpu_v1
70+
type: service
71+
env:
72+
- name: NAME
73+
value: Welcome to OCI Data Science.
74+
scriptPathURI: https://raw.githubusercontent.com/oracle-samples/oci-data-science-ai-samples/432357b123b7401ef67b116fe19aec217ca920f0/jobs/python/job%2Bsamples/greeting-env-cmd.py

0 commit comments

Comments
 (0)