deployed Custom Python IOT EDGE module on edge device always in "Stopped" status.

Roshan Ardeshana 26 Reputation points
2022-10-10T10:12:11.917+00:00

Hi community,

I am currently working on creating python module for IOT EDGE device. When I only run "SimulatedTemperatureSensor" module provided by azure I am able to run it and monitor the data.

When try to run custom python module for IOT EDGE device, it is directly going to "Stopped" state in device.

My custom python code currently contains a simple dataframe operation. I am using vscode in local system for development. I am able to push the docker image as module to azure-container-registry. From there I am able deploy the module to IOT EDGE device.

I am following below links

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
561 questions
Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
428 questions
0 comments No comments
{count} votes

Accepted answer
  1. QuantumCache 20,261 Reputation points
    2022-10-13T07:08:36.813+00:00

    Hello @Roshan Ardeshana , Please make sure your module is running , it has to meet the condition in your code. Please take a closer look at the below code where i am running the sample in a While loop.

    Similarly please have a look at the sample Github page :

    249962-image.png

    When i don't use the While loop or the criteria is not met , my Python module is Stopped and no further telemetry is sent:

    After i started using the criteria (While Loop) or any other condition as mentioned in the GitHub samples, the module keeps running.

    249938-image.png

    249974-image.png

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. QuantumCache 20,261 Reputation points
    2022-10-10T16:50:11.397+00:00

    Hello @Roshan Ardeshana ,
    Did you try to check the logs on the IoT Edge for the Python's Custom module?

    sudo iotedge logs dataframeModuleName  
    

    Troubleshoot your IoT Edge device

    View module logs in the portal

    249019-image.png

    0 comments No comments

  2. Roshan Ardeshana 26 Reputation points
    2022-10-11T05:04:45.74+00:00

    Hi @QuantumCache

    I did check the logs. Unfortunately, I could not find any hints that can help. Here is the output of Troubleshoot your IoT Edge device.

    $edgeAgent

    <6> 2022-10-10 06:50:39.674 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 06:50:39.675 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 06:50:39.676 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bedgeAgent\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}
    <6> 2022-10-10 06:50:39.692 +00:00 [INF] - Initiating streaming logs for edgeAgent
    <6> 2022-10-10 06:50:39.746 +00:00 [INF] - Received 569 bytes of logs for edgeAgent
    <6> 2022-10-10 06:50:39.746 +00:00 [INF] - Successfully handled request GetModuleLogs
    <6> 2022-10-10 07:03:43.390 +00:00 [INF] - Received direct method call - ping
    <6> 2022-10-10 07:03:43.390 +00:00 [INF] - Received request ping with payload
    <6> 2022-10-10 07:03:43.390 +00:00 [INF] - Successfully handled request ping
    <6> 2022-10-10 07:03:43.672 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 07:03:43.673 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 07:03:43.673 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bTest1Module\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}
    <6> 2022-10-10 07:03:43.689 +00:00 [INF] - Initiating streaming logs for Test1Module
    <6> 2022-10-10 07:03:43.698 +00:00 [INF] - Received 20 bytes of logs for Test1Module
    <6> 2022-10-10 07:03:43.698 +00:00 [INF] - Successfully handled request GetModuleLogs
    <6> 2022-10-10 07:04:28.146 +00:00 [INF] - Received direct method call - ping
    <6> 2022-10-10 07:04:28.147 +00:00 [INF] - Received request ping with payload
    <6> 2022-10-10 07:04:28.147 +00:00 [INF] - Successfully handled request ping
    <6> 2022-10-10 07:04:28.415 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 07:04:28.415 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 07:04:28.418 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bTest1Module\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}
    <6> 2022-10-10 07:04:28.435 +00:00 [INF] - Initiating streaming logs for Test1Module
    <6> 2022-10-10 07:04:28.443 +00:00 [INF] - Received 20 bytes of logs for Test1Module
    <6> 2022-10-10 07:04:28.444 +00:00 [INF] - Successfully handled request GetModuleLogs
    <6> 2022-10-10 07:04:30.749 +00:00 [INF] - Received direct method call - RestartModule
    <6> 2022-10-10 07:04:30.749 +00:00 [INF] - Received request RestartModule with payload
    <6> 2022-10-10 07:04:30.750 +00:00 [INF] - Processing request to restart Test1Module
    <6> 2022-10-10 07:04:30.764 +00:00 [INF] - Restarting Test1Module...
    <6> 2022-10-10 07:04:30.765 +00:00 [INF] - Executing command: "Restart module Test1Module"
    <6> 2022-10-10 07:04:31.819 +00:00 [INF] - Restarted Test1Module
    <6> 2022-10-10 07:04:31.823 +00:00 [INF] - Successfully handled request RestartModule
    <6> 2022-10-10 07:04:32.087 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 07:04:32.087 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 07:04:32.088 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bTest1Module\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}
    <6> 2022-10-10 07:04:32.107 +00:00 [INF] - Initiating streaming logs for Test1Module
    <6> 2022-10-10 07:04:32.118 +00:00 [INF] - Received 20 bytes of logs for Test1Module
    <6> 2022-10-10 07:04:32.118 +00:00 [INF] - Successfully handled request GetModuleLogs
    <6> 2022-10-10 07:04:35.974 +00:00 [INF] - Updated reported properties
    <6> 2022-10-10 07:04:38.301 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 07:04:38.301 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 07:04:38.302 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bTest1Module\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}
    <6> 2022-10-10 07:04:38.322 +00:00 [INF] - Initiating streaming logs for Test1Module
    <6> 2022-10-10 07:04:38.331 +00:00 [INF] - Received 20 bytes of logs for Test1Module
    <6> 2022-10-10 07:04:38.331 +00:00 [INF] - Successfully handled request GetModuleLogs
    <6> 2022-10-10 07:05:24.854 +00:00 [INF] - Received direct method call - ping
    <6> 2022-10-10 07:05:24.855 +00:00 [INF] - Received request ping with payload
    <6> 2022-10-10 07:05:24.855 +00:00 [INF] - Successfully handled request ping
    <6> 2022-10-10 07:05:25.120 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 07:05:25.121 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 07:05:25.121 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bTest1Module\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}
    <6> 2022-10-10 07:05:25.137 +00:00 [INF] - Initiating streaming logs for Test1Module
    <6> 2022-10-10 07:05:25.151 +00:00 [INF] - Received 20 bytes of logs for Test1Module
    <6> 2022-10-10 07:05:25.151 +00:00 [INF] - Successfully handled request GetModuleLogs
    <6> 2022-10-10 07:05:26.815 +00:00 [INF] - Received direct method call - GetModuleLogs
    <6> 2022-10-10 07:05:26.815 +00:00 [INF] - Received request GetModuleLogs with payload
    <6> 2022-10-10 07:05:26.816 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\bedgeAgent\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1}

    $edgeHub

    <6> 2022-10-10 06:53:10.523 +00:00 [INF] - Entering periodic task to reauthenticate connected clients
    <6> 2022-10-10 06:58:10.518 +00:00 [INF] - Entering periodic task to reauthenticate connected clients
    <6> 2022-10-10 07:03:10.521 +00:00 [INF] - Entering periodic task to reauthenticate connected clientsRetrieved 3 line(s)

    Test1Module

    No log

    0 comments No comments

  3. Roshan Ardeshana 26 Reputation points
    2022-10-11T13:27:23.72+00:00

    Hi @QuantumCache

    Thank you for your response.

    I was able to resolve the issue related to 'Stopped" status.

    Now module is in running state still I am not able to receive the responses from the python script. Python script contains a simple dataframe operations.