Checkpoint

Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
bnechyporenko
2024-02-06 20:30:27 +01:00
parent 7a186fc801
commit ca7ec6a0cb
2 changed files with 22 additions and 19 deletions
@@ -357,7 +357,10 @@ export class NunjucksWorkflowRunner implements WorkflowRunner {
try {
let prevValue: U | undefined;
if (prevTaskState) {
prevValue = prevTaskState.state[key] as unknown as U;
const prevState = prevTaskState.state[key];
if (prevState.status === 'success') {
prevValue = prevState.value as U;
}
}
const value = prevValue ? prevValue : await fn();
+18 -18
View File
@@ -26,6 +26,24 @@ export type TaskSecrets = Record<string, string> & {
backstageToken?: string;
};
/**
* The record passed to {@link TaskBroker.updateCheckpoint?}
* Parameters to store the result of the executed checkpoint
*
* @public
*/
export type CheckpointRecord =
| {
key: string;
status: 'success';
value: JsonObject;
}
| {
key: string;
status: 'failed';
reason: string;
};
/**
* TaskState
*
@@ -115,24 +133,6 @@ export type TaskBrokerDispatchOptions = {
createdBy?: string;
};
/**
* The record passed to {@link TaskBroker.updateCheckpoint?}
* Parameters to store the result of the executed checkpoint
*
* @public
*/
export type CheckpointRecord =
| {
key: string;
status: 'success';
value: JsonObject;
}
| {
key: string;
status: 'failed';
reason: string;
};
/**
* Task
*