File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -412,6 +412,14 @@ def dryrun(
412412 ):
413413 sched = self ._scheduler (scheduler )
414414 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+
415423 if workspace and isinstance (sched , WorkspaceMixin ):
416424 role = app .roles [0 ]
417425 old_img = role .image
@@ -420,7 +428,13 @@ def dryrun(
420428 logger .info (
421429 'To disable workspaces pass: --workspace="" from CLI or workspace=None programmatically.'
422430 )
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
424438
425439 if old_img != role .image :
426440 logger .info (
Original file line number Diff line number Diff line change @@ -337,12 +337,19 @@ def log_iter(
337337 f"{ self .__class__ .__qualname__ } does not support application log iteration"
338338 )
339339
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+
340348 def _validate (self , app : AppDef , scheduler : str , cfg : T ) -> None :
341349 """
342- Validates whether application is consistent with the scheduler.
350+ Validates after workspace build whether application is consistent with the scheduler.
343351
344- Raises:
345- ValueError: if application is not compatible with scheduler
352+ Raises error if application is not compatible with scheduler
346353 """
347354 for role in app .roles :
348355 if role .resource == NULL_RESOURCE :
You can’t perform that action at this time.
0 commit comments