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

Split "Initialized" state into two states #12

Open
Tracked by #23
TaiSakuma opened this issue Jul 28, 2023 · 0 comments
Open
Tracked by #23

Split "Initialized" state into two states #12

TaiSakuma opened this issue Jul 28, 2023 · 0 comments

Comments

@TaiSakuma
Copy link
Member

The current state diagram:


             .-------------.
             |   Created   |---.
             '-------------'   |
      initialize() |           |
                   |           |
                   V           |
             .-------------.   |
        .--->| Initialized |---.
reset() |    '-------------'   |
        |      |   | run()     |
        |------'   |           |
        |          v           |
        |    .-------------.   |
        |    |   Running   |---.
        |    '-------------'   |
        |          | finish()  |
        |          |           |
        |          V           |
        |    .-------------.   |  close()  .-------------.
        '----|  Finished   |-------------->|   Closed    |
             '-------------'               '-------------'

Currently, the "Initialized" state is re-entered every time the script is
modified because a new script is given as an argument of reset(). When the
"Initialized" state is entered,

  • the run number is incremented,
  • a new row is created on the run table in the database.

Furthermore, currently, the script is stored on the run table.

Consequently, the run table includes rows for runs that are only initialized and
never run. On the other hand, it is not possible to create a new row in the
"Running" state because then the latest script will not be stored unless the run
actually starts.

In order to avoid rows on the run table for runs that are only initialized, we
can split the "Initialized" state into two states: "Initialized" and "Ready".

A possible state diagram with a new state "Ready":


             .-------------.
             |   Created   |---.
             '-------------'   |
      initialize() |           |
                   |           |
                   V           |
             .-------------.   |
        .--->| Initialized |---.
reset() |    '-------------'   |
        |      |   | ready()   |
        |------'   |           |
        |          v           |
        |    .-------------.   |
        .----|    Ready    |---.
        |    '-------------'   |
        |          | run()     |
        |          |           |
        |          v           |
        |    .-------------.   |
        |    |   Running   |---.
        |    '-------------'   |
        |          | finish()  |
        |          |           |
        |          V           |
        |    .-------------.   |  close()  .-------------.
        '----|  Finished   |-------------->|   Closed    |
             '-------------'               '-------------'

When the "Ready" state is entered,

  • the run number is incremented,
  • a new row is created on the run table in the database.

The "Initialized" state is re-entered every time the script is modified.

The remaining problem is that the script will not be stored in the database
unless the "Ready" state is entered. This problem is addressed in another issue.

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