perf: 支持已跳过的步骤重新运行

This commit is contained in:
xiaojunnuo
2024-09-02 18:36:12 +08:00
parent 724a85028b
commit ea775adae1
20 changed files with 105 additions and 87 deletions
@@ -36,6 +36,8 @@ export class Executor {
options: ExecutorOptions;
abort: AbortController = new AbortController();
_inited = false;
onChanged: (history: RunHistory) => Promise<void>;
constructor(options: ExecutorOptions) {
this.options = options;
@@ -50,6 +52,10 @@ export class Executor {
}
async init() {
if (this._inited) {
return;
}
this._inited = true;
const lastRuntime = await this.pipelineContext.getObj(`lastRuntime`);
this.lastRuntime = lastRuntime;
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
@@ -315,4 +321,8 @@ export class Executor {
}
}
}
clearLastStatus(stepId: string) {
this.lastStatusMap.clearById(stepId);
}
}
@@ -166,6 +166,14 @@ export class RunnableCollection {
});
}
clearById(id: string) {
const runnable = this.collection[id];
if (runnable?.status) {
runnable.status.status = ResultType.none;
runnable.status.result = ResultType.none;
}
}
add(runnable: Runnable) {
this.collection[runnable.id] = runnable;
}