Are there any example of how to use Flytekit.Senso...
# ask-the-community
r
Are there any example of how to use Flytekit.Sensor ?
l
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
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
Yes it is different
You can print the value in sensor engine, and you will know how it works.
r
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
maybe it's about config map cc @Kevin Su
k
I’m writing to the doc, sorry
did you deploy an agent in your cluster?