Error in the processing of a function

A pipeline run fails because of an error in a function.

Symptoms

An analysis stopped message is displayed on the Data tab of the device type.

Probable cause

Review the message that is displayed in the pipeline log file and identify the function that caused the error. Some common Python errors are listed in Table 1. The most common errors are key errors and index errors.

Table 1. Probable cause by error type

Error type Probable cause
Key error A function tries to access a key in a dictionary or in a data frame that does not exist. The missing key is typically the name of a data item. The error indicates that something went wrong in the calculation of this data item.
Index error A function tries to access an index that is outside the bounds of a list. A common index error results from an operation in a custom function cutting up a data frame. For tips on fixing index errors, see Function catalog tips.
Name error A function cannot find the identifier, for example, a device ID is not found. If you are referring to data items in a pandas expression, refer to the data item name by using a quoted string, for example, 'pressure'.
Attribute error A function tries to access an attribute of a device that does not exist.
Type error An argument to the function is not of the right type. For example, in your code, you provide a string instead of an integer.
Syntax error An incorrect statement, for example, adding an extra bracket in the code.
Value error An argument to a function is of the right type, but the value is invalid, for example, an empty string.

Resolution

  1. In the side navigation, click Monitor.
  2. On the Device types tab, select a device type that has a pipeline error (Pipeline error) and click Data.
  3. Click the warning icon for the Analysis stopped messages (Analysis stopped) and click Show log. You can download the log to view it offline. The log shows the function that the pipeline was executing when an error occurred, for example, “The pipeline failed at the “PythonExpression” stage.”.
  4. Find the calculation that uses the function.
    1. Scroll through the calculated data items to see whether any of these data items display an error.
    2. If none display an error, check the configuration of each data item until you find one that uses the function.
  5. Fix the error in your local code and push the updated code to your repository.
  6. Register the function again. To register a function, see Using custom functions.