Skip to content

Commit 6b3fbdf

Browse files
committed
Fixed pipeline step to dict.
1 parent 3329287 commit 6b3fbdf

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ads/pipeline/ads_pipeline_step.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,19 @@ def to_dict(self) -> dict:
519519
dict_details["spec"][self.CONST_JOB_ID] = self.job_id
520520
if self.description:
521521
dict_details["spec"][self.CONST_DESCRIPTION] = self.description
522+
if self.kind == "ML_JOB":
523+
if self.environment_variable:
524+
dict_details["spec"][self.CONST_ENVIRONMENT_VARIABLES] = (
525+
self.environment_variable
526+
)
527+
if self.argument:
528+
dict_details["spec"][self.CONST_COMMAND_LINE_ARGUMENTS] = (
529+
self.argument
530+
)
531+
if self.maximum_runtime_in_minutes:
532+
dict_details["spec"][self.CONST_MAXIMUM_RUNTIME_IN_MINUTES] = (
533+
self.maximum_runtime_in_minutes
534+
)
522535

523536
dict_details["spec"].pop(self.CONST_DEPENDS_ON, None)
524537

tests/unitary/default_setup/pipeline/test_pipeline_step.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class DataSciencePipelineStepBaseTest(unittest.TestCase):
3838
PipelineStep("TestUpstreamPipelineStepOne")
3939
.with_description("Test upstream pipeline step description one")
4040
.with_job_id("TestJobIdOne")
41+
.with_environment_variable(**{"test_key": "test_value"})
42+
.with_maximum_runtime_in_minutes(20)
43+
.with_argument("--key val path/to/file")
4144
)
4245

4346
upstream_pipeline_step_two = (
@@ -85,6 +88,11 @@ def test_pipeline_step_to_dict(self):
8588
"name": "TestUpstreamPipelineStepOne",
8689
"jobId": "TestJobIdOne",
8790
"description": "Test upstream pipeline step description one",
91+
"environmentVariables": {
92+
"test_key": "test_value"
93+
},
94+
"commandLineArguments": "--key val path/to/file",
95+
"maximumRuntimeInMinutes": 20
8896
},
8997
}
9098

0 commit comments

Comments
 (0)