File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tests/unitary/default_setup/jobs Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 2020 ScriptRuntime ,
2121 NotebookRuntime ,
2222)
23+ from ads .jobs .builders .infrastructure .dsc_job import DataScienceJobRun
2324from ads .jobs .builders .infrastructure .dsc_job_runtime import (
2425 CondaRuntimeHandler ,
2526 ScriptRuntimeHandler ,
@@ -603,3 +604,25 @@ def test_run_details_link_fail(self, mock_extract_region):
603604 test_run_instance = RunInstance ()
604605 test_result = test_run_instance .run_details_link
605606 assert test_result == ""
607+
608+
609+ class DataScienceJobMethodTest (DataScienceJobPayloadTest ):
610+
611+ @patch ("ads.jobs.builders.infrastructure.dsc_job.DataScienceJobRun.cancel" )
612+ @patch ("ads.jobs.ads_job.Job.run_list" )
613+ def test_job_cancel (self , mock_run_list , mock_cancel ):
614+ mock_run_list .return_value = [
615+ DataScienceJobRun (
616+ lifecycle_state = "CANCELED"
617+ )
618+ ] * 3
619+
620+ job = (
621+ Job (name = "test" )
622+ .with_infrastructure (infrastructure .DataScienceJob ())
623+ .with_runtime (ScriptRuntime ().with_script (self .SCRIPT_URI ))
624+ )
625+
626+ job .cancel ()
627+ mock_run_list .assert_called ()
628+ mock_cancel .assert_called_with (wait_for_completion = False )
You can’t perform that action at this time.
0 commit comments