Goal

The goal of this system is to make it easy to:

  1. Add/remove state machines from Workspaces
  2. Add/remove state machine types from Workspaces
  3. Change the type of a capability's state machine (e.g. make null have QA or make std_calibration have two-stage QA)
  4. Ensure correctness of state machines
  5. Modify existing state machine templates from within Python and eliminate the need for tedious/error-prone database table manipulation

Design

Overview

The short version of the design is that I want to add a state machine initialization step to the initialization process of the system. This state machine initialization will perform the following steps:

  1. Clear the following tables of entries:
    1. capability_state_transitions
    2. capability_state_actions
  2. Get the list of state machines from a new database table: capability_state_machines
    1. capability_state_machines definition: Three columns:
      1. capability_name: varchar (primary key)
      2. and machine_type: varchar
  3. For each entry in that table, populate capability_state_transitions and capability_state_actions based on in-code definitions (using SQLAlchemy model objects)

New files

  1. state_machine_info.py - Parallel to capability_info.py; performs necessary CRUD database operations for state machine manipulation/initialization
  2. state_machine_schema.py - Holds declarative model for state-machine table


Unanswered questions

  1. How should the in-code state machine representations be coded? I want to use SQLAlchemy model classes, but is it possible?
    1. My plan to answer this is to just mess around in-code and see how easy/hard it is to hard-code the definitions in
  2. Is clearing/re-creating those two tables every time the system starts up a good idea? Should I instead do an audit of those tables to check that all the appropriate rows are in place and no additional ones are (harder and more time-consuming)?
  • No labels