MCPcopy Create free account
hub / github.com/StackStorm/st2 / run

Method run

contrib/hello_st2/sensors/sensor1.py:30–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

28 pass
29
30 def run(self):
31 while not self._stop:
32 self._logger.debug("HelloSensor dispatching trigger...")
33 count = self.sensor_service.get_value("hello_st2.count") or 0
34 payload = {"greeting": "Yo, StackStorm!", "count": int(count) + 1}
35 self.sensor_service.dispatch(trigger="hello_st2.event1", payload=payload)
36 self.sensor_service.set_value("hello_st2.count", payload["count"])
37 eventlet.sleep(60)
38
39 def cleanup(self):
40 self._stop = True

Callers

nothing calls this directly

Calls 3

get_valueMethod · 0.45
dispatchMethod · 0.45
set_valueMethod · 0.45

Tested by

no test coverage detected