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

Continue-as-new support #11

Closed
kaibocai opened this issue Dec 6, 2023 · 0 comments
Closed

Continue-as-new support #11

kaibocai opened this issue Dec 6, 2023 · 0 comments
Assignees

Comments

@kaibocai
Copy link
Member

kaibocai commented Dec 6, 2023

The SDK should support continue-as-new pattern for orchestration.

end-to-end example

  it("should allow to continue as new", async () => {
    const orchestrator: TOrchestrator = async function* (ctx: OrchestrationContext, input: number): any {
      if (input < 10) {
        ctx.continueAsNew(input + 1, true);
      } else {
        return input;
      }
    };

    taskHubWorker.addOrchestrator(orchestrator);
    await taskHubWorker.start();

    const id = await taskHubClient.scheduleNewOrchestration(orchestrator, 1);

    const state = await taskHubClient.waitForOrchestrationCompletion(id, undefined, 30);
    expect(state);
    expect(state?.runtimeStatus).toEqual(OrchestrationStatus.ORCHESTRATION_STATUS_COMPLETED);
    expect(state?.serializedOutput).toEqual(10);
  }, 31000);

Tested failed on local

Reference: #4

@kaibocai kaibocai self-assigned this Dec 19, 2023
@kaibocai kaibocai closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant