Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/cli-v3/src/entryPoints/managed/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ export class RunExecution {
this.abortExecution();
return;
}
case "QUEUED": {
this.sendDebugLog("Run was re-queued", snapshotMetadata);

// Pretend we've just suspended the run. This will kill the process without failing the run.
await this.taskRunProcess?.suspend();
return;
}
case "FINISHED": {
this.sendDebugLog("Run is finished", snapshotMetadata);

Expand Down Expand Up @@ -402,8 +409,7 @@ export class RunExecution {

return;
}
case "RUN_CREATED":
case "QUEUED": {
case "RUN_CREATED": {
this.sendDebugLog("Invalid status change", snapshotMetadata);

this.abortExecution();
Expand Down
21 changes: 13 additions & 8 deletions packages/core/src/v3/runtime/managedRuntimeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ export class ManagedRuntimeManager implements RuntimeManager {
private ipc: ExecutorToWorkerProcessConnection,
private showLogs: boolean
) {
setTimeout(() => {
this.log("Runtime status", {
resolversbyWaitId: this.resolversByWaitId.keys(),
resolversByWaitpoint: this.resolversByWaitpoint.keys(),
});
}, 1000);
// Log out the runtime status on a long interval to help debug stuck executions
setInterval(() => {
this.log("[DEBUG] ManagedRuntimeManager status", this.status);
}, 300_000);
}

disable(): void {
Expand Down Expand Up @@ -178,14 +176,14 @@ export class ManagedRuntimeManager implements RuntimeManager {
}

if (!waitId) {
this.log("No waitId found for waitpoint", waitpoint);
this.log("No waitId found for waitpoint", { ...this.status, ...waitpoint });
return;
}

const resolve = this.resolversByWaitId.get(waitId);

if (!resolve) {
this.log("No resolver found for waitId", waitId);
this.log("No resolver found for waitId", { ...this.status, waitId });
return;
}

Expand Down Expand Up @@ -227,4 +225,11 @@ export class ManagedRuntimeManager implements RuntimeManager {
if (!this.showLogs) return;
console.log(`[${new Date().toISOString()}] ${message}`, args);
}

private get status() {
return {
resolversbyWaitId: Array.from(this.resolversByWaitId.keys()),
resolversByWaitpoint: Array.from(this.resolversByWaitpoint.keys()),
};
}
}
Loading
Loading