Unit State

The unit state is one way to know what is happening with a unit in the application.

Use the Lens Apps app info -a to see the unit state.

$ lapps app info -a dashboard
Application: dashboard
Repository: git@localhost:dashboard.git
Platform: python
...
Units: 1
+------------+---------+
| Unit       | State   |
+------------+---------+
| 8cf863c4c1 | started |
+------------+---------+

The following list describes the available states for units in Lens AppIQ:

  • Created is the initial status of an unit.
  • Building is the status for units being provisioned by the provisioner, for example during deployment.
  • Error is the status for units that failed to start, because of an application error.
  • Starting is set when the container is started in docker.
  • Started is for cases where the unit is up and running.
  • Stopped is for cases where the unit has been stopped.

The unit state flow can be represented by the following chart:

+----------+                           start          +---------+
| building |                   +---------------------+| stopped |
+----------+                   |                      +---------+
      ^                        |                           ^
      |                        |                           |
 deploy unit                   |                         stop
      |                        |                           |
      +                        v       RegisterUnit        +
 +---------+  app unit   +----------+  SetUnitStatus  +---------+
 | created | +---------> | starting | +-------------> | started |
 +---------+             +----------+                 +---------+
                               +                         ^ +
                               |                         | |
                         SetUnitStatus                   | |
                               |                         | |
                               v                         | |
                           +-------+     SetUnitStatus   | |
                           | error | +-------------------+ |
                           +-------+ <---------------------+