If enabled, each running Chart will save its state when the Gateway is shut down. Prior to shutting down, the Gateway will record the state of each persistent Chart to a file in Ignition's installation directory. Once the Gateway comes back online, the Gateway will read this file, and the Chart will resume from where it left off. Values of each chart-scoped variable will be maintained between restarts.
Because the state is recorded on shutdown, all of the following conditions must be true for the state to be preserved:
- The Gateway has time to record the state before the operating system terminates the process
- The Chart is between script executions.
In the case of an expected shutdown (the operating system was requested to restart), all running scripts need to stop in a timely manner for the record to be taken, otherwise the operating system may force the Gateway to stop before the record is taken. It is recommended to design your chart in a manner that can easily be paused. This is usually accomplished by breaking up tasks into multiple smaller scripts. More details can be found on the Action Step Best Practices page.
In the event of unexpected shutdown, such as power to the server was cut-out, then the state will not be properly recorded. However, Ignition Redundancy can be used to protect against unexpected shutdowns.
When enabled, the chart state and parameters will be synchronized across a redundant cluster, allowing a backup node to continue after chart execution. This can continue where the chart left off in the master, or the On Redundant Failover function can be used to restart, modify, or cancel the charts execution within the backup.
Synchronization only occurs when starting a new step. This means that any long running steps that updates variables multiple times throughout its execution will not be properly synced, and the variables will be out of date when starting at that step. The system.sfc.redundantCheckpoint() function can create a "checkpoint" in the step execution, allowing you to manually sync the steps variables to the same step on the redundant node. The function can be used multiple times throughout a step, depending how long the step takes to execute, and how often values are updated.
Similar in concept to Event Handlers on Vision components, Event Scripts trigger when certain actions occur in a running chart. The following events are available:
|On Start||This will run once when the chart is started|
|On Stop||This will run once when the chart is stopped normally. Specifically, when flow leads into an End Step.|
|On Cancel||This will run once if the chart is cancelled.|
This will run once if the chart is aborted. This occurs when an error in a script causes the whole Chart to fail. If the script on this event fails, a log message will appear in the Gateway console. The exception that caused the abort is available via
|On Redundant Failover|
This will run once if the chart is activated due to a redundancy failover. Has two special arguments: