File tree 2 files changed +25
-4
lines changed
2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -412,6 +412,14 @@ def dryrun(
412
412
):
413
413
sched = self ._scheduler (scheduler )
414
414
resolved_cfg = sched .run_opts ().resolve (cfg )
415
+
416
+ # early validation before build workspace
417
+ with log_event (
418
+ "pre_build_validate" ,
419
+ scheduler ,
420
+ ):
421
+ sched ._pre_build_validate (app , scheduler , resolved_cfg )
422
+
415
423
if workspace and isinstance (sched , WorkspaceMixin ):
416
424
role = app .roles [0 ]
417
425
old_img = role .image
@@ -420,7 +428,13 @@ def dryrun(
420
428
logger .info (
421
429
'To disable workspaces pass: --workspace="" from CLI or workspace=None programmatically.'
422
430
)
423
- sched .build_workspace_and_update_role (role , workspace , resolved_cfg )
431
+ with log_event (
432
+ "build_workspace_and_update_role" ,
433
+ scheduler ,
434
+ ) as ctx :
435
+ sched .build_workspace_and_update_role (role , workspace , resolved_cfg )
436
+ ctx ._torchx_event .app_image = role .image
437
+ ctx ._torchx_event .workspace = workspace
424
438
425
439
if old_img != role .image :
426
440
logger .info (
Original file line number Diff line number Diff line change @@ -337,12 +337,19 @@ def log_iter(
337
337
f"{ self .__class__ .__qualname__ } does not support application log iteration"
338
338
)
339
339
340
+ def _pre_build_validate (self , app : AppDef , scheduler : str , cfg : T ) -> None :
341
+ """
342
+ validates before workspace build whether application is consistent with the scheduler.
343
+
344
+ Raises error if application is not compatible with scheduler
345
+ """
346
+ pass
347
+
340
348
def _validate (self , app : AppDef , scheduler : str , cfg : T ) -> None :
341
349
"""
342
- Validates whether application is consistent with the scheduler.
350
+ Validates after workspace build whether application is consistent with the scheduler.
343
351
344
- Raises:
345
- ValueError: if application is not compatible with scheduler
352
+ Raises error if application is not compatible with scheduler
346
353
"""
347
354
for role in app .roles :
348
355
if role .resource == NULL_RESOURCE :
You can’t perform that action at this time.
0 commit comments