--

Trigger is responsible for queuing task for only 1 time - this is not true.

In your Trigger code you will have a while loop:

while True:

for path in glob(self.filepath):

if os.path.isfile(path):

self.log.info("Found File %s ", str(path))

yield TriggerEvent(True)

await asyncio.sleep(self.poll_interval)

and in your sensor you will defer like this:

self.defer(

timeout=timedelta(seconds=self.timeout),

trigger=FileTrigger(

filepath=path,

poll_interval=self.poke_interval,

),

method_name="execute_complete",

)

--

--

Amit Singh Rathore
Amit Singh Rathore

Written by Amit Singh Rathore

Staff Data Engineer @ Visa — Writes about Cloud | Big Data | ML

Responses (1)