Stream data analytics FAQ

Updated at:

This topic describes frequently asked questions about stream data analytics and its tasks.

Check task status

Run the following command in the remote console:
/linkedge/gateway/build/bin/lectl sc show
The system returns a response similar to the following example. If the value of the running parameter is true, the task is running.
========================= TOTALCOUNT  02 =========================

------------------------------- 01 -------------------------------
    ID: sca6xxxxxxxxxxxxxxxxxxxxxxxxxxxx34
    Name: High temperature alarm
    Running: true
    SQLPath: /linkedge/run/stream-compute/sql/sca6xxxxxxxxxxxxxxxxxxxxxxxxxxxx34.sql
    SQLMd5: 8a76629992c7710ee742709658ffa7dc
    LogPath: /linkedge/run/logger/stream-compute/sca6xxxxxxxxxxxxxxxxxxxxxxxxxxxx34/log.INFO

------------------------------- 02 -------------------------------
    ID: sc62xxxxxxxxxxxxxxxxxxxxxxxxxxxxf6
    Name: Average temperature
    Running: true
    SQLPath: /linkedge/run/stream-compute/sql/sc62xxxxxxxxxxxxxxxxxxxxxxxxxxxxf6.sql
    SQLMd5: 1a037f7e4dcb7ab6910dba23b4d93ce2
    LogPath: /linkedge/run/logger/stream-compute/sc62xxxxxxxxxxxxxxxxxxxxxxxxxxxxf6/log.INFO
The following table describes the fields.
Field Description
ID The unique ID of the task (streamID).
Name The name of the task.
Running The running status of the task.
  • true: The task is running.
  • false: The task is stopped.
SQLPath The storage path of the SQL file.
SQLMd5 The MD5 hash of the SQL file.
LogPath The path of the task log.

Check if the task receives device data

  1. In the remote console, use tool_config to set the log level to debug.
    /linkedge/gateway/build/bin/tool_config -s gw_logger_level debug
  2. Run the following command to view the task log. The output shows the device data that the task receives.
    tail -f /linkedge/run/logger/stream-compute/sc62xxxxxxxxxxxxxxxxxxxxxxxxxxxxf6/log.INFO | grep DATA_INPUT

    In the command, sc62xxxxxxxxxxxxxxxxxxxxxxxxxxxxf6 is the unique ID of the task (streamID).

Why does a task stop running?

To determine why a task stopped, check the task log. The following are common reasons:

  • SQL syntax error

    Solution: In the IoT Platform console, go to the Data Analytics > Real-Time Data Analytics page. Validate the SQL for the task in the editor. After the SQL is validated, publish the task. For more information, see SQL-based tasks.

  • The SQL statement includes a database, but the database connection fails.

    Solution: See Why does a database connection fail?.

  • The SQL statement includes a database, but the task fails to read from or insert data into it.

    Solution: Ensure that the table format in the output database matches the format defined in the stream data analytics SQL.

How to resume a stopped task

You can use one of the following methods to restart the task:
  • To update the task content, follow these steps:

    In the IoT Platform console, go to the Data Analytics > Real-Time Data Analytics page. Modify the task and redeploy it to the edge. For more information, see SQL-based tasks.

  • If you do not need to update the task content, follow these steps:
    Log on to the remote console and run the following command to start the task:
    /linkedge/gateway/build/bin/sctl start scxxxxxxxx

    In the command, scxxxxxxxx is the unique ID of the task that you want to start.

Check if the computing result is sent to the edge message bus

  1. Log on to the remote console.
  2. Use dbus-monitor to print real-time messages from the edge message bus. If the output contains the message topic, the computing result was sent to the message bus.
    /linkedge/gateway/build/bin/dbus-monitor --address unix:path=/tmp/var/run/mbusd/mbusd_socket

Database connection fails

  1. Verify that the database username and password are configured in the configuration center.
    If they are not configured, run the following commands to save the username and password to the configuration center:
    cd /linkedge/gateway/build/bin
    ./tool_config -s your_username_key your_username_value
    ./tool_config -s your_password_key your_password_key
    Note
    • Replace your_username_key and your_password_key with the keys defined in the stream data analytics SQL.
    • Replace your_username_value and your_password_value with the actual database username and password.
  2. Verify that the host, port, username, and password are correct.