Skip to content

Commit 650533b

Browse files
committed
refactor execution and squash some bugs
1 parent 235372d commit 650533b

File tree

4 files changed

+331
-267
lines changed

4 files changed

+331
-267
lines changed

packages/cli-v3/src/entryPoints/managed/controller.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class ManagedRunController {
143143
}
144144

145145
private get snapshotFriendlyId() {
146-
return this.currentExecution?.snapshotFriendlyId;
146+
return this.currentExecution?.currentSnapshotFriendlyId;
147147
}
148148

149149
private lockedRunExecution: Promise<void> | null = null;
@@ -182,28 +182,33 @@ export class ManagedRunController {
182182
});
183183
}
184184

185-
this.subscribeToRunNotifications(runFriendlyId, snapshotFriendlyId);
186-
187185
// Create a new RunExecution instance for this attempt
188186
const newExecution = new RunExecution({
189-
runFriendlyId,
190-
snapshotFriendlyId,
191-
dequeuedAt,
192-
podScheduledAt,
193-
isWarmStart,
194187
workerManifest: this.workerManifest,
195188
env: this.env,
196189
httpClient: this.httpClient,
197190
logger: this.logger,
198191
});
199192

193+
// If we have a current execution with task run env, prepare the new execution
200194
if (this.currentExecution?.taskRunEnv) {
201-
newExecution.prepareForExecution(this.currentExecution.taskRunEnv);
195+
newExecution.prepareForExecution({
196+
taskRunEnv: this.currentExecution.taskRunEnv,
197+
});
202198
}
203199

204200
this.currentExecution = newExecution;
205201

206-
await this.currentExecution.execute();
202+
// Subscribe to run notifications
203+
this.subscribeToRunNotifications(runFriendlyId, snapshotFriendlyId);
204+
205+
await this.currentExecution.execute({
206+
runFriendlyId,
207+
snapshotFriendlyId,
208+
dequeuedAt,
209+
podScheduledAt,
210+
isWarmStart,
211+
});
207212
};
208213

209214
this.lockedRunExecution = execution();

0 commit comments

Comments
 (0)