Skip to content

Question: conditionally skip multiple actions based on an event #29

Open
@max-arnold

Description

@max-arnold

Let's assume the following orchestration:

def orch(ctx: task.OrchestrationContext, _):
    result = yield ctx.call_activity(hello, input='Tokyo')
    if result:
         yield ctx.call_activity(hello, input='Seattle')
    else:
         yield ctx.call_activity(hello, input='London')

    yield ctx.call_activity(hello, input='END')
    return None

How can I modify it to listen for an external event that will skip the pending activities and jump directly to the END one?

In other words, how to model complex FSMs when some of the state transitions (fast-forward, or continue-as-new) are triggered externally and I do not want to wrap every activity call with yield task.when_any?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions