Skip to content

Parallel state: multiple instances of same compond state #614

Description

@Motioneer

Hello!
I was wondering if it is possible to create a parallel state that is not composed of unique compound states, but multiple copies of the same.

My use case is, that a process involves a list of items that should be processed in parallel, with each item using an instance of a statemachine. Only if all items have processed and their individual statemachines have finished, the overall process should advance.

To illustrate it more, here is a bit of pseudo statemachine code:

class Battle(State.Compound):
      fighting = State(initial=True)
      won = State(final=True)
      victory = fighting.to(won)

class War(StateChart):
    class war(State.Parallel):
        battles = [Battle, Battle, Battle]

Is this even conceptionally possible, or does this break a fundamental rule?
Thank you in advance for any guidance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions