Longest Running (Python Programs)

The Python branch of the Server Status Tool includes a Longest Running category. You can use this category to investigate potential performance issues with long-running Python programs. 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 Longest Running category represents a Python program for which the Python code is stored in a Python Program item in the database. The category shows those Python programs that have taken the longest duration to run. By default, the top 10 programs are displayed. The entries are displayed sorted by Longest Runtime, in descending order, by default.

The information for each entry is categorized as follows:

  • 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.
  • Run Count—The number of times that the Python program has run since the statistics were last reset.

    For more information, see Most Frequently Run (Python Programs).

  • Average Runtime—The average time that the Python program takes to run.

    If the average runtime for a particular Python program looks unexpectedly longer than others, review the Python code for that program.

  • Longest Runtime—The longest time that the Python program has taken to run since the statistics were last reset.
  • Completion of Longest Runtime—The completion date and time of the run that took the longest time to complete.

    If one run took a substantially longer time than other runs of the same Python program, you might want to check other data, such as entries in the Events List from around this time. This might help to identify the potential cause of that long runtime.

  • Run Timeouts—The number of times that a run of the Python program has been aborted before the program has run to completion, due to the Python program exceeding its Runtime Limit.

    If a particular program has an unexpected number of run timeouts:

    • Review the Python code for that program.

    • If the last run of the Python program timed out, the Status display of the Python Program item will show the program's State as 'Timed Out'.

    • Compare the program's Average Runtime (see above) with the Runtime Limit that is configured for that program. Determine whether the program's Runtime Limit needs increasing; this comprises a property on the configuration form of the Python Program item (see Specify the Runtime Limit of a Python Program).

  • 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).

You can reset the statistics counts by using the Reset All option. You can access this option in a context-sensitive menu by right-clicking on an entry in the list. This 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 other displays, such as the Most Frequently Run category of the Server Status Tool.

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.

Further Information

Define the Maximum Number of Diagnostic Rows that are Shown for Python Programs in the Server Status Tool: see Define the Program Limits on the Server in the Geo SCADA Expert Guide to the Python Driver.

Display a Driver Log File.