File tree 2 files changed +46
-0
lines changed
sdk/python/v1beta1/kubeflow/katib/api 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -532,6 +532,8 @@ class name in this argument.
532
532
if storage_per_trial :
533
533
if isinstance (storage_per_trial , dict ):
534
534
storage_per_trial = [storage_per_trial ]
535
+ elif not isinstance (storage_per_trial , list ):
536
+ raise ValueError ("storage_per_trial must be a list of dictionaries" )
535
537
for storage in storage_per_trial :
536
538
volume = None
537
539
if isinstance (storage ["volume" ], client .V1Volume ):
Original file line number Diff line number Diff line change @@ -404,6 +404,50 @@ def create_experiment(
404
404
},
405
405
ValueError ,
406
406
),
407
+ (
408
+ "invalid storage_per_trial - type mismatch" ,
409
+ {
410
+ "name" : "tune_test" ,
411
+ "objective" : lambda x : print (f"a={ x } " ),
412
+ "parameters" : {"a" : katib .search .int (min = 10 , max = 100 )},
413
+ "storage_per_trial" : "invalid" ,
414
+ },
415
+ ValueError ,
416
+ ),
417
+ (
418
+ "invalid storage_per_trial - volume has no name" ,
419
+ {
420
+ "name" : "tune_test" ,
421
+ "objective" : lambda x : print (f"a={ x } " ),
422
+ "parameters" : {"a" : katib .search .int (min = 10 , max = 100 )},
423
+ "storage_per_trial" : [
424
+ {
425
+ "volume" : {
426
+ # do not provide name
427
+ "type" : "pvc" ,
428
+ }
429
+ }
430
+ ],
431
+ },
432
+ ValueError ,
433
+ ),
434
+ (
435
+ "invalid storage_per_trial - volume has no type" ,
436
+ {
437
+ "name" : "tune_test" ,
438
+ "objective" : lambda x : print (f"a={ x } " ),
439
+ "parameters" : {"a" : katib .search .int (min = 10 , max = 100 )},
440
+ "storage_per_trial" : [
441
+ {
442
+ "volume" : {
443
+ "name" : "test-pvc" ,
444
+ # do not provide type
445
+ }
446
+ }
447
+ ],
448
+ },
449
+ ValueError ,
450
+ ),
407
451
(
408
452
"invalid model_provider_parameters" ,
409
453
{
You can’t perform that action at this time.
0 commit comments