Skip to content

Split "Initialized" state into two states #12

@TaiSakuma

Description

@TaiSakuma

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.

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