35
35
from ads .jobs .builders .runtimes .container_runtime import ContainerRuntime
36
36
from ads .jobs .builders .runtimes .python_runtime import GitPythonRuntime
37
37
38
- from ads .common .dsc_file_system import (
39
- OCIFileStorage ,
40
- DSCFileSystemManager
41
- )
38
+ from ads .common .dsc_file_system import OCIFileStorage , DSCFileSystemManager
42
39
43
40
logger = logging .getLogger (__name__ )
44
41
@@ -445,6 +442,8 @@ def run(self, **kwargs) -> DataScienceJobRun:
445
442
* command_line_arguments: str
446
443
* maximum_runtime_in_minutes: int
447
444
* display_name: str
445
+ * freeform_tags: dict(str, str)
446
+ * defined_tags: dict(str, object)
448
447
449
448
If display_name is not specified, it will be generated as "<JOB_NAME>-run-<TIMESTAMP>".
450
449
@@ -845,7 +844,7 @@ class DataScienceJob(Infrastructure):
845
844
.with_storage_mount(
846
845
{
847
846
"src" : "<mount_target_ip_address>:<export_path>",
848
- "dest" : "<destination_directory_name>"
847
+ "dest" : "<destination_directory_name>"
849
848
}
850
849
)
851
850
)
@@ -1231,9 +1230,7 @@ def log_group_id(self) -> str:
1231
1230
"""
1232
1231
return self .get_spec (self .CONST_LOG_GROUP_ID )
1233
1232
1234
- def with_storage_mount (
1235
- self , * storage_mount : List [dict ]
1236
- ) -> DataScienceJob :
1233
+ def with_storage_mount (self , * storage_mount : List [dict ]) -> DataScienceJob :
1237
1234
"""Sets the file systems to be mounted for the data science job.
1238
1235
A maximum number of 5 file systems are allowed to be mounted for a single data science job.
1239
1236
@@ -1425,7 +1422,8 @@ def _update_job_infra(self, dsc_job: DSCJob) -> DataScienceJob:
1425
1422
"Storage mount hasn't been supported in the current OCI SDK installed."
1426
1423
)
1427
1424
dsc_job .job_storage_mount_configuration_details_list = [
1428
- DSCFileSystemManager .initialize (file_system ) for file_system in self .storage_mount
1425
+ DSCFileSystemManager .initialize (file_system )
1426
+ for file_system in self .storage_mount
1429
1427
]
1430
1428
return self
1431
1429
@@ -1477,7 +1475,13 @@ def create(self, runtime, **kwargs) -> DataScienceJob:
1477
1475
return self
1478
1476
1479
1477
def run (
1480
- self , name = None , args = None , env_var = None , freeform_tags = None , wait = False
1478
+ self ,
1479
+ name = None ,
1480
+ args = None ,
1481
+ env_var = None ,
1482
+ freeform_tags = None ,
1483
+ defined_tags = None ,
1484
+ wait = False ,
1481
1485
) -> DataScienceJobRun :
1482
1486
"""Runs a job on OCI Data Science job
1483
1487
@@ -1491,6 +1495,8 @@ def run(
1491
1495
Environment variable for the job run, by default None
1492
1496
freeform_tags : dict, optional
1493
1497
Freeform tags for the job run, by default None
1498
+ defined_tags : dict, optional
1499
+ Defined tags for the job run, by default None
1494
1500
wait : bool, optional
1495
1501
Indicate if this method should wait for the run to finish before it returns, by default False.
1496
1502
@@ -1505,11 +1511,18 @@ def run(
1505
1511
raise RuntimeError (
1506
1512
"Job is not created. Call create() to create the job first."
1507
1513
)
1508
- tags = self .runtime .freeform_tags
1509
- if not tags :
1510
- tags = {}
1511
- if freeform_tags :
1512
- tags .update (freeform_tags )
1514
+
1515
+ if not freeform_tags :
1516
+ freeform_tags = {}
1517
+ runtime_freeform_tags = self .runtime .freeform_tags
1518
+ if runtime_freeform_tags :
1519
+ freeform_tags .update (runtime_freeform_tags )
1520
+
1521
+ if not defined_tags :
1522
+ defined_tags = {}
1523
+ runtime_defined_tags = self .runtime .defined_tags
1524
+ if runtime_defined_tags :
1525
+ defined_tags .update (runtime_defined_tags )
1513
1526
1514
1527
if name :
1515
1528
envs = self .runtime .envs
@@ -1521,7 +1534,8 @@ def run(
1521
1534
display_name = name ,
1522
1535
command_line_arguments = args ,
1523
1536
environment_variables = env_var ,
1524
- freeform_tags = tags ,
1537
+ freeform_tags = freeform_tags ,
1538
+ defined_tags = defined_tags ,
1525
1539
wait = wait ,
1526
1540
)
1527
1541
0 commit comments