https://flyte.org logo
#ask-the-community
Title
# ask-the-community
r

Ryuu

10/04/2023, 7:43 AM
Are there any example of how to use Flytekit.Sensor ?
l

L godlike

10/04/2023, 9:04 AM
Copy code
from flytekit.sensor.file_sensor import FileSensor
from flytekit import task, workflow

sensor = FileSensor(name="test_sensor")
@task()
def t1():
    print("flyte")

@workflow
def wf():
    sensor(path="/tmp/123") >> t1()

if __name__ == "__main__":
    wf()
r

Ryuu

10/04/2023, 11:11 AM
This is the example about The Sensor extend BaseSensor. I have read the git i saw about SensorEngine Which registed to Agent. Is this different than base_sensor
l

L godlike

10/04/2023, 11:11 AM
Yes it is different
You can print the value in sensor engine, and you will know how it works.
r

Ryuu

10/05/2023, 9:36 AM
Workflow[flytesnacks:development:<http://sensor_task.wf|sensor_task.wf>] failed. RuntimeExecutionError: max number of system retry attempts [11/10] exhausted. Last known status message: failed at Node[n0]. RuntimeExecutionError: failed during plugin execution, caused by: failed to execute handle for plugin [container]: [BadTaskSpecification] invalid TaskSpecification, unable to determine Pod configuration
I catch this error when I run your above file test sensor script on remote. For some results, the sensor on remote can attempts muximum 10 times, not infinity. I am dev on flyte demo sandbox enviroment( flyte demo start). How to fix this
or maybe 10 attemps for another bugs
l

L godlike

10/05/2023, 12:14 PM
maybe it's about config map cc @Kevin Su
k

Kevin Su

10/05/2023, 5:59 PM
I’m writing to the doc, sorry
did you deploy an agent in your cluster?