Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: update durabletask fork and finish set custom status #647

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
support set custom status
Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com>
famarting committed Dec 3, 2024
commit b854457fc9b80a688fd97b516a119f34c09287dc
10 changes: 10 additions & 0 deletions src/workflow/client/WorkflowState.ts
Original file line number Diff line number Diff line change
@@ -105,4 +105,14 @@ export class WorkflowState {
public get workflowFailureDetails(): WorkflowFailureDetails | undefined {
return this._workflowFailureDetails;
}


/**
* Gets the workflow instance's custom status, if any, as a string value.
* @returns {string | undefined} The workflow instance's custom status or undefined.
*/
public get customStatus(): string | undefined {
return this._orchestrationState.serializedCustomStatus;
}

}
9 changes: 9 additions & 0 deletions src/workflow/runtime/WorkflowContext.ts
Original file line number Diff line number Diff line change
@@ -156,6 +156,15 @@ export default class WorkflowContext {
this._innerContext.continueAsNew(newInput, saveEvents);
}

/**
* Sets the custom status
*
* @param status {string} The new custom status
*/
public setCustomStatus(status: string): void {
this._innerContext.setCustomStatus(status);
}

/**
* Returns a task that completes when all of the provided tasks complete or when one of the tasks fail
*
3 changes: 2 additions & 1 deletion test/e2e/workflow/workflow.test.ts
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ describe("Workflow", () => {
current = yield ctx.callActivity(plusOne, current);
numbers.push(current);
}

ctx.setCustomStatus("foo");
return numbers;
};

@@ -93,6 +93,7 @@ describe("Workflow", () => {
expect(state?.runtimeStatus).toEqual(WorkflowRuntimeStatus.COMPLETED);
expect(state?.serializedInput).toEqual(JSON.stringify(1));
expect(state?.serializedOutput).toEqual(JSON.stringify([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]));
expect(state?.customStatus).toEqual("foo");
}, 31000);

it("should be able to run fan-out/fan-in", async () => {