I have a sensor that looks for a csv file in a certain directory every 60 seconds, parses it, sends the necessary trigger with the values to an action and then deletes the file. I designed it on the lines of the “Running your sensor example” in this link (refer to the code in the section " Examples" under " Running Your First Sensor")
Whats happening is that the sensor doesnt seem to get awake every 60 seconds by itself. However, if I forcefully debug the sensor like so:
/opt/stackstorm/st2/bin/st2sensorcontainer --config-file=/etc/st2/st2.conf --debug --sensor-ref=my_pack_sensors.FileWatchSensor
It suddenly starts working! What I noticed is that it doesnt seem to like the part where I delete the file (using os.remove()). If I remove that part, the sensor again starts happily emitting the triggers without the need to invoke the debugging like above. I even tried renaming instead of deleting still, no surprise, same result.
Please advise if there is anything I can look into to fix this issue - I dont want to retain the csv file after its processed, and its kind of surprising why the sensor is behaving that way. I even tried replacing it with a polling sensor , still same result.