Programs (Python Programs)
The Python branch of the Server Status Tool includes a Programs category. You can use this category to ascertain which Python programs on the server are currently running, or queued pending a run. The statistics relate to Python programs that the Geo SCADA Expert server is configured to execute. They do not relate to Python programs that you execute by other means outside of Geo SCADA Expert to interact with the Geo SCADA Expert database.
Each entry in the Programs category represents a Python program for which the Python code is stored in a Python Program item in the database. The entries are displayed sorted by Trigger Time, in ascending order, by default.
The following information is displayed:
- Object Id—A unique number that Geo SCADA Expert uses to identify the Python Program item in the database.
- Name—The full name of the Python Program item, including its full path in the database.
- State—The current 'run' status of the Python program. The category only includes programs that are in one of the following states:
- Running—The program is currently running.
- Pending—The requested run of the program is queued and awaiting execution.
Geo SCADA Expert can run several Python programs simultaneously. You use a property in the Python section of the Server Configuration Tool to specify the Maximum Number of Running Programs that the server can run simultaneously (see Define the Program Limits on the Server). Once this limit has been reached, the server adds any further 'Run' requests to the Execution Queue for the relevant program and assigns those 'Run' requests the 'Pending' status. (The exception to this is if either Execution Queue Limit has been exceeded (see below).)
The server maintains an internal 'master list' of 'Run' requests that it receives from all of the Python programs. This includes any 'Run' requests that get placed in a program's Execution Queue. The server executes each 'Run' request in chronological order. New 'Run' requests are added to the bottom of the server's internal 'master list' and are only addressed once they reach the top of that list.
- Trigger—The activity that caused Geo SCADA Expert to execute this particular run of the program. Be aware that with Python programs that are configured to have multiple Trigger Conditions, the Trigger might vary per run. The possible options are:
- Method—The program executes whenever its Run pick action is triggered, or the Run method is called.
- Periodic—The program executes on a periodic basis, as per the Interval settings on the configuration form of that Python Program item.
- On Object Change—The program executes on the change in value or state of a specific item ('object') in the Geo SCADA Expert database. The database item has to be a Point or Accumulator. The change that triggers the program to execute is a data change (rather than a configuration change) on the Point or Accumulator.
For more information about any of the Trigger Conditions, see Define the Run Settings of a Python Program.
- Trigger Time—The date and time that the current or pending run was triggered.
- Start Time—Only populated when the program is actually running. This column shows the date and time that the current run started.
Typically, the Start Time will be the same as the Trigger Time if Geo SCADA Expert is able to run the program as soon as it has received a request to do so. The Start Time will differ from the Trigger Time if that program run was queued before the run commenced. For more information about the circumstances that might lead to a program run being queued, see Pending Executions below.
- Geo SCADA Expert User—The User Account under which the program is configured to run. The User Account determines the level of access that the Python program has to any database items that it references and to any database methods that it calls.
For more information, see Specify the User under which a Python Program Runs.
- Pending Executions—The number of further 'Run' requests of the program that are currently queued and waiting to run. Geo SCADA Expert can run several Python programs simultaneously, but can only run one instance of a specific Python program at a time. A number other than 0 (zero) in this column indicates that there are other 'Run' requests of the program in that particular program's Execution Queue, waiting to run. This might be due to the run to which the Trigger Time relates still being in progress, or that run still pending due to the server's configured Maximum Number of Running Programs having been reached (see Define the Program Limits on the Server). Geo SCADA Expert will execute the requests in the Pending Executions column in the order in which they appear in that Execution Queue, once the current run (or pending run) has finished. (Providing that the server's Maximum Number of Running Programs is no longer being exceeded.)
If a particular program has an unexpectedly high number of Pending Executions, you might want to check whether there is an issue with any of its Trigger Conditions (see Define the Run Settings of a Python Program). You might also want to check the program code of the Python program (see Write and Edit the Program Code in a Python Program). For information about other checks you might want to make if a Python program has an unexpectedly high Run Count, see Most Frequently Run (Python Programs).
- Maximum Pending Executions—The greatest number of 'Run' requests of that particular program that have been queued for execution on the server since the statistics were last reset.
Each Python Program item has its own Execution Queue Limit (see Specify the Execution Queue Limit of a Python Program). The server also has an Execution Queue Limit (see Define the Program Limits on the Server). You might want to compare the values in the Maximum Pending Executions column against those limits. If the values are close to either limit, you might want to consider extending one or other of those limits.
- Discarded Pending Executions—The number of run requests that the server has discarded due to an Execution Queue Limit being exceeded. Each program-specific Execution Queue Limit works in conjunction with the server's Execution Queue Limit. For examples that demonstrate how the two settings work, see Define the Program Limits on the Server. Once either limit has been exceeded, the server discards any further 'Run' requests.
If a particular program has an unexpected number of Discarded Pending Executions, you might want to check whether any of its Trigger Conditions are causing the program to run more frequently than expected (see Define the Run Settings of a Python Program). You might also want to check the program code of the Python program (see Write and Edit the Program Code in a Python Program). For information about other checks you might want to make if a Python program has an unexpectedly high Run Count, see Most Frequently Run (Python Programs).
The values shown in the Executions columns are some of the counts that you can reset, along with other statistics counts, by using the Reset All option. You can access this option in a context-sensitive menu from the Longest Running or Most Frequently Run categories of the Server Status Tool. The option resets the statistics counts for all Python programs that the Geo SCADA Expert server is configured to execute. This includes the counts that appear on those and other displays in Geo SCADA Expert.
If you only want to reset the statistics counts for one particular Python program, you can do so via the Reset Counts pick action. Use ViewX to access this pick action for the relevant Python Program item.
The counts reset automatically on system restart and when the driver is restarted. If the Reset counters option is enabled in the Snapshots section of the Server Configuration tool, the counts also reset automatically as part of the statistics counts reset that occurs after each server snapshot is logged. For more information about this latter option, see Server Snapshot Log Files.