@@ -63,8 +63,7 @@ def test_show_simple(tmp_dir, scm, dvc, exp_stage):
63
63
"metrics" : {"metrics.yaml" : {"data" : {"foo" : 1 }}},
64
64
"outs" : {},
65
65
"params" : {"params.yaml" : {"data" : {"foo" : 1 }}},
66
- "queued" : False ,
67
- "running" : False ,
66
+ "status" : "Success" ,
68
67
"executor" : None ,
69
68
"timestamp" : None ,
70
69
}
@@ -97,8 +96,7 @@ def test_show_experiment(tmp_dir, scm, dvc, exp_stage, workspace):
97
96
"metrics" : {"metrics.yaml" : {"data" : {"foo" : 1 }}},
98
97
"outs" : {},
99
98
"params" : {"params.yaml" : {"data" : {"foo" : 1 }}},
100
- "queued" : False ,
101
- "running" : False ,
99
+ "status" : "Success" ,
102
100
"executor" : None ,
103
101
"timestamp" : timestamp ,
104
102
"name" : "master" ,
@@ -130,7 +128,7 @@ def test_show_queued(tmp_dir, scm, dvc, exp_stage):
130
128
assert len (results ) == 2
131
129
exp = results [exp_rev ]["data" ]
132
130
assert exp ["name" ] == "test_name"
133
- assert exp ["queued" ]
131
+ assert exp ["status" ] == "Queued"
134
132
assert exp ["params" ]["params.yaml" ] == {"data" : {"foo" : 2 }}
135
133
136
134
# test that only queued experiments for the current baseline are returned
@@ -145,10 +143,67 @@ def test_show_queued(tmp_dir, scm, dvc, exp_stage):
145
143
results = dvc .experiments .show ()[new_rev ]
146
144
assert len (results ) == 2
147
145
exp = results [exp_rev ]["data" ]
148
- assert exp ["queued" ]
146
+ assert exp ["status" ] == "Queued"
149
147
assert exp ["params" ]["params.yaml" ] == {"data" : {"foo" : 3 }}
150
148
151
149
150
+ @pytest .mark .vscode
151
+ def test_show_failed_experiment (tmp_dir , scm , dvc , failed_exp_stage ):
152
+ baseline_rev = scm .get_rev ()
153
+ timestamp = datetime .fromtimestamp (
154
+ scm .gitpython .repo .rev_parse (baseline_rev ).committed_date
155
+ )
156
+
157
+ dvc .experiments .run (
158
+ failed_exp_stage .addressing , params = ["foo=2" ], queue = True
159
+ )
160
+ exp_rev = dvc .experiments .scm .resolve_rev (f"{ CELERY_STASH } @{{0}}" )
161
+ dvc .experiments .run (run_all = True )
162
+ experiments = dvc .experiments .show ()[baseline_rev ]
163
+
164
+ expected_baseline = {
165
+ "data" : {
166
+ "deps" : {
167
+ "copy.py" : {
168
+ "hash" : ANY ,
169
+ "size" : ANY ,
170
+ "nfiles" : None ,
171
+ }
172
+ },
173
+ "metrics" : {},
174
+ "outs" : {},
175
+ "params" : {"params.yaml" : {"data" : {"foo" : 1 }}},
176
+ "status" : "Success" ,
177
+ "executor" : None ,
178
+ "timestamp" : timestamp ,
179
+ "name" : "master" ,
180
+ }
181
+ }
182
+
183
+ expected_failed = {
184
+ "data" : {
185
+ "timestamp" : ANY ,
186
+ "params" : {"params.yaml" : {"data" : {"foo" : 2 }}},
187
+ "deps" : {"copy.py" : {"hash" : None , "size" : None , "nfiles" : None }},
188
+ "outs" : {},
189
+ "status" : "Failed" ,
190
+ "executor" : None ,
191
+ "error" : {
192
+ "msg" : "Experiment run failed." ,
193
+ "type" : "" ,
194
+ },
195
+ }
196
+ }
197
+
198
+ assert len (experiments ) == 2
199
+ for rev , exp in experiments .items ():
200
+ if rev == "baseline" :
201
+ assert exp == expected_baseline
202
+ else :
203
+ assert rev == exp_rev
204
+ assert exp == expected_failed
205
+
206
+
152
207
@pytest .mark .vscode
153
208
@pytest .mark .parametrize ("workspace" , [True , False ])
154
209
def test_show_checkpoint (
@@ -339,12 +394,8 @@ def test_show_sort(tmp_dir, scm, dvc, exp_stage, caplog):
339
394
340
395
341
396
@pytest .mark .vscode
342
- @pytest .mark .parametrize (
343
- "status, running" , [(TaskStatus .RUNNING , True ), (TaskStatus .FAILED , False )]
344
- )
345
- def test_show_running_workspace (
346
- tmp_dir , scm , dvc , exp_stage , capsys , status , running
347
- ):
397
+ @pytest .mark .parametrize ("status" , [TaskStatus .RUNNING , TaskStatus .FAILED ])
398
+ def test_show_running_workspace (tmp_dir , scm , dvc , exp_stage , capsys , status ):
348
399
pid_dir = os .path .join (dvc .tmp_dir , EXEC_TMP_DIR , EXEC_PID_DIR )
349
400
info = make_executor_info (
350
401
location = BaseExecutor .DEFAULT_LOCATION , status = status
@@ -357,7 +408,8 @@ def test_show_running_workspace(
357
408
makedirs (os .path .dirname (pidfile ), True )
358
409
(tmp_dir / pidfile ).dump_json (info .asdict ())
359
410
360
- print (dvc .experiments .show ())
411
+ print (dvc .experiments .show ().get ("workspace" ))
412
+
361
413
assert dvc .experiments .show ().get ("workspace" ) == {
362
414
"baseline" : {
363
415
"data" : {
@@ -371,17 +423,20 @@ def test_show_running_workspace(
371
423
"metrics" : {"metrics.yaml" : {"data" : {"foo" : 1 }}},
372
424
"params" : {"params.yaml" : {"data" : {"foo" : 1 }}},
373
425
"outs" : {},
374
- "queued" : False ,
375
- "running" : True if running else False ,
376
- "executor" : info .location if running else None ,
426
+ "status" : "Running"
427
+ if status == TaskStatus .RUNNING
428
+ else "Success" ,
429
+ "executor" : info .location
430
+ if status == TaskStatus .RUNNING
431
+ else None ,
377
432
"timestamp" : None ,
378
433
}
379
434
}
380
435
}
381
436
capsys .readouterr ()
382
437
assert main (["exp" , "show" , "--csv" ]) == 0
383
438
cap = capsys .readouterr ()
384
- if running :
439
+ if status == TaskStatus . RUNNING :
385
440
assert "Running" in cap .out
386
441
assert info .location in cap .out
387
442
@@ -428,10 +483,10 @@ def test_show_running_tempdir(tmp_dir, scm, dvc, exp_stage, mocker):
428
483
[mocker .call (stash_rev , pidfile , True )],
429
484
)
430
485
exp_data = get_in (results , [baseline_rev , exp_rev , "data" ])
431
- assert exp_data ["running" ]
486
+ assert exp_data ["status" ] == "Running"
432
487
assert exp_data ["executor" ] == info .location
433
488
434
- assert not results ["workspace" ]["baseline" ]["data" ]["running" ]
489
+ assert results ["workspace" ]["baseline" ]["data" ]["status" ] == "Success"
435
490
436
491
437
492
def test_show_running_celery (tmp_dir , scm , dvc , exp_stage , mocker ):
@@ -453,11 +508,10 @@ def test_show_running_celery(tmp_dir, scm, dvc, exp_stage, mocker):
453
508
454
509
results = dvc .experiments .show ()
455
510
exp_data = get_in (results , [baseline_rev , exp_rev , "data" ])
456
- assert not exp_data ["queued" ]
457
- assert exp_data ["running" ]
511
+ assert exp_data ["status" ] == "Running"
458
512
assert exp_data ["executor" ] == info .location
459
513
460
- assert not results ["workspace" ]["baseline" ]["data" ]["running" ]
514
+ assert results ["workspace" ]["baseline" ]["data" ]["status" ] == "Success"
461
515
462
516
463
517
def test_show_running_checkpoint (tmp_dir , scm , dvc , checkpoint_stage , mocker ):
@@ -479,6 +533,11 @@ def test_show_running_checkpoint(tmp_dir, scm, dvc, checkpoint_stage, mocker):
479
533
"iter_active" ,
480
534
return_value = entries ,
481
535
)
536
+ mocker .patch .object (
537
+ dvc .experiments .celery_queue ,
538
+ "iter_failed" ,
539
+ return_value = [],
540
+ )
482
541
pidfile = queue .get_infofile_path (entries [0 ].stash_rev )
483
542
info = make_executor_info (
484
543
git_url = "foo.git" ,
@@ -495,10 +554,10 @@ def test_show_running_checkpoint(tmp_dir, scm, dvc, checkpoint_stage, mocker):
495
554
results = dvc .experiments .show ()
496
555
497
556
checkpoint_res = get_in (results , [baseline_rev , checkpoint_rev , "data" ])
498
- assert checkpoint_res ["running" ]
557
+ assert checkpoint_res ["status" ] == "Running"
499
558
assert checkpoint_res ["executor" ] == info .location
500
559
501
- assert not results ["workspace" ]["baseline" ]["data" ]["running" ]
560
+ assert results ["workspace" ]["baseline" ]["data" ]["status" ] == "Success"
502
561
503
562
504
563
def test_show_with_broken_repo (tmp_dir , scm , dvc , exp_stage , caplog ):
0 commit comments