22
22
from ads .aqua .finetuning .constants import FineTuneCustomMetadata
23
23
from ads .aqua .finetuning .entities import AquaFineTuningParams
24
24
from ads .jobs .ads_job import Job
25
+ from ads .jobs .builders .infrastructure .dsc_job import DataScienceJobRun
25
26
from ads .model .datascience_model import DataScienceModel
26
27
from ads .model .model_metadata import ModelCustomMetadata
27
28
from ads .aqua .common .errors import AquaValueError
@@ -49,6 +50,12 @@ def tearDownClass(cls):
49
50
reload (ads .aqua )
50
51
reload (ads .aqua .finetuning .finetuning )
51
52
53
+ @parameterized .expand (
54
+ [
55
+ ("watch_logs" , True ),
56
+ ("watch_logs" , False ),
57
+ ]
58
+ )
52
59
@patch .object (Job , "run" )
53
60
@patch ("ads.jobs.ads_job.Job.name" , new_callable = PropertyMock )
54
61
@patch ("ads.jobs.ads_job.Job.id" , new_callable = PropertyMock )
@@ -60,6 +67,8 @@ def tearDownClass(cls):
60
67
@patch .object (AquaApp , "get_source" )
61
68
def test_create_fine_tuning (
62
69
self ,
70
+ mock_watch_logs ,
71
+ mock_watch_logs_called ,
63
72
mock_get_source ,
64
73
mock_mvs_create ,
65
74
mock_ds_model_create ,
@@ -117,6 +126,7 @@ def test_create_fine_tuning(
117
126
ft_job_run .id = "test_ft_job_run_id"
118
127
ft_job_run .lifecycle_details = "Job run artifact execution in progress."
119
128
ft_job_run .lifecycle_state = "IN_PROGRESS"
129
+ ft_job_run .watch = MagicMock ()
120
130
mock_job_run .return_value = ft_job_run
121
131
122
132
self .app .ds_client .update_model = MagicMock ()
@@ -144,7 +154,20 @@ def test_create_fine_tuning(
144
154
defined_tags = ft_model_defined_tags ,
145
155
)
146
156
147
- aqua_ft_summary = self .app .create (** create_aqua_ft_details )
157
+ inputs = {
158
+ ** create_aqua_ft_details ,
159
+ ** {
160
+ mock_watch_logs : mock_watch_logs_called ,
161
+ "log_id" : "test_log_id" ,
162
+ "log_group_id" : "test_log_group_id" ,
163
+ },
164
+ }
165
+ aqua_ft_summary = self .app .create (** inputs )
166
+
167
+ if mock_watch_logs_called :
168
+ ft_job_run .watch .assert_called ()
169
+ else :
170
+ ft_job_run .watch .assert_not_called ()
148
171
149
172
assert aqua_ft_summary .to_dict () == {
150
173
"console_url" : f"https://cloud.oracle.com/data-science/models/{ ft_model .id } ?region={ self .app .region } " ,
0 commit comments