File tree Expand file tree Collapse file tree 1 file changed +20
-17
lines changed
src/lightning_app/components Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -58,27 +58,30 @@ def run(
58
58
self ._cloud_compute = cloud_compute
59
59
self ._work_args = work_args
60
60
self ._work_kwargs = work_kwargs
61
- self .has_initialized = False
61
+ self .has_started = False
62
62
63
63
def run (self ) -> None :
64
- # 1. Create & start the works
65
- if not self .has_initialized :
66
- for node_rank in range (self .nodes ):
67
- self .ws .append (
68
- self ._work_cls (
69
- * self ._work_args ,
70
- cloud_compute = self ._cloud_compute ,
71
- ** self ._work_kwargs ,
72
- parallel = True ,
64
+ if not self .has_started :
65
+
66
+ # 1. Create & start the works
67
+ if not self .ws :
68
+ for node_rank in range (self .nodes ):
69
+ self .ws .append (
70
+ self ._work_cls (
71
+ * self ._work_args ,
72
+ cloud_compute = self ._cloud_compute ,
73
+ ** self ._work_kwargs ,
74
+ parallel = True ,
75
+ )
73
76
)
74
- )
75
- # Starting node `node_rank`` ...
76
- self .ws [- 1 ].start ()
77
- self .has_initialized = True
77
+ # Starting node `node_rank`` ...
78
+ self .ws [- 1 ].start ()
79
+
80
+ # 2. Wait for all machines to be started !
81
+ if not all (w .status .stage == WorkStageStatus .STARTED for w in self .ws ):
82
+ return
78
83
79
- # 2. Wait for all machines to be started !
80
- if all (w .status .stage == WorkStageStatus .STARTED for w in self .ws ):
81
- return
84
+ self .has_started = True
82
85
83
86
# Loop over all node machines
84
87
for node_rank in range (self .nodes ):
You can’t perform that action at this time.
0 commit comments