Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

Upstart currently has a three-level state machine; goal, job state and process state. This specification proposes reducing that to a two-level state machine, combining the two lower levels into one.

Rationale

The current three-level state machine is confusing, and doesn't allow as much flexibility as we would like. In particular, it's not ideal for extending the states to allow for additional scripts and actions.

Use cases

Scope

The scope of this specification is limited to modifying the current state machine, specifying where the events defined in JobEvents are emitted and when the scripts specified in JobScripts are to be run.

Design

State Diagram

The easiest way to describe the proposed state machine is with a diagram (dot source):

states.png

Within this diagram, the following applies:

Notes

Implementation

Code

The implementation is largely confined to upstart/job.h, init/job.h and init/job.c.

The Job structure will lose its process_state member, and the ProcessState enum will be removed.

job_next_state and job_change_state will be amended to use the new states, other references will be adjusted.

Data preservation and migration

These changes are backwards compatible with the previous behaviour.


CategorySpec

JobStates (last edited 2011-08-26 04:10:17 by localhost)