Max Lei
05/12/2021, 7:46 PM[2021-05-12 12:26:05-0700] INFO - prefect.task_name | Waiting for next scheduled run at 2021-05-13T10:00:00+00:00
2021-05-12 12:26:05,221 - prefect.task_name - INFO - Waiting for next scheduled run at 2021-05-13T10:00:00+00:00
But the local agent somehow runs two of the same flow twice.
How should I debug this issue?Kevin Kho
Max Lei
05/12/2021, 7:47 PMKevin Kho
Max Lei
05/12/2021, 7:49 PMKevin Kho
Max Lei
05/12/2021, 7:51 PMMax Lei
05/12/2021, 7:52 PMMax Lei
05/12/2021, 7:53 PMKevin Kho
Max Lei
05/12/2021, 8:00 PMKevin Kho
Zanie
PREFECT__CLOUD__AGENT__LEVEL=DEBUG
Max Lei
05/12/2021, 8:09 PMMax Lei
05/12/2021, 8:11 PMprefect agent <AGENT TYPE> start --env KEY=VALUE --env KEY2=VALUE2
In the docsZanie
Max Lei
05/12/2021, 8:29 PM[2021-05-12 20:22:58,810] DEBUG - agent | Found flow runs ['734edd41-a9de-4ab9-86b4-aaf332fa1179'] (1 already submitting: ['734edd41-a9de-4ab9-86b4-aaf332fa1179'])
[2021-05-12 20:22:58,810] DEBUG - agent | Next query for flow runs in 0.5 seconds
[2021-05-12 20:22:59,311] DEBUG - agent | Querying for flow runs
[2021-05-12 20:22:59,331] DEBUG - agent | Found flow runs ['734edd41-a9de-4ab9-86b4-aaf332fa1179'] (1 already submitting: ['734edd41-a9de-4ab9-86b4-aaf332fa1179'])
[2021-05-12 20:22:59,331] DEBUG - agent | Next query for flow runs in 1.0 seconds
[2021-05-12 20:23:00,001] DEBUG - agent | Updating states for flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179
[2021-05-12 20:23:00,006] DEBUG - agent | Flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179 is in a Scheduled state, updating to Submitted
[2021-05-12 20:23:00,046] INFO - agent | Deploying flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179
[2021-05-12 20:23:00,050] DEBUG - agent | Submitted flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179 to process PID 31690
[2021-05-12 20:23:00,068] DEBUG - agent | Completed flow run submission (id: 734edd41-a9de-4ab9-86b4-aaf332fa1179)
Looks OK to me for now though. I think I’ll need to export this and just let it sit through tasks this week and see what happens.Zanie
Max Lei
05/12/2021, 8:41 PMMax Lei
05/12/2021, 8:42 PM[2021-05-05 10:00:02,060] INFO - agent | Found 1 flow run(s) to submit for execution.
[2021-05-05 10:00:02,176] INFO - agent | Deploying flow run 87e78b14-dcf5-44e0-b7dd-e8d07340356e
[2021-05-05 22:11:45,212] ERROR - agent | HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efdb49b8450>: Failed to establish a new connection: [Errno 111] Co
nnection refused'))
[2021-05-05 22:11:55,214] ERROR - agent | HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efdb496fd90>: Failed to establish a new connection: [Errno 101] Ne
twork is unreachable'))
____ __ _ _ _
| _ \ _ __ ___ / _| ___ ___| |_ / \ __ _ ___ _ __ | |_
| |_) | '__/ _ \ |_ / _ \/ __| __| / _ \ / _` |/ _ \ '_ \| __|
| __/| | | __/ _| __/ (__| |_ / ___ \ (_| | __/ | | | |_
|_| |_| \___|_| \___|\___|\__| /_/ \_\__, |\___|_| |_|\__|
|___/
[2021-05-05 22:14:19,077] INFO - agent | Starting LocalAgent with labels ['ml-build', 'azure-flow-storage', 'gcs-flow-storage', 's3-flow-storage', 'github-flow-storage', 'webhook-flow-storage', 'gitlab-flow-storage']
[2021-05-05 22:14:19,078] INFO - agent | Agent documentation can be found at <https://docs.prefect.io/orchestration/>
[2021-05-05 22:14:19,078] INFO - agent | Agent connecting to the Prefect API at <http://localhost:4200>
[2021-05-05 22:14:19,085] INFO - agent | Waiting for flow runs...
[2021-05-06 10:00:07,830] INFO - agent | Found 1 flow run(s) to submit for execution.
[2021-05-06 10:00:07,869] INFO - agent | Deploying flow run 69433bdb-981a-4135-af51-a495c44eeecf
[2021-05-06 14:00:02,978] INFO - agent | Found 1 flow run(s) to submit for execution.
[2021-05-06 14:00:03,012] INFO - agent | Deploying flow run c75e4314-9edd-4168-81ac-4fd86efc8acb
Max Lei
05/13/2021, 12:37 AMZanie
Zanie
Max Lei
05/13/2021, 12:52 AM[2021-05-12 20:22:58,499] DEBUG - agent | Querying for flow runs
[2021-05-12 20:22:58,521] DEBUG - agent | Found flow runs ['734edd41-a9de-4ab9-86b4-aaf332fa1179']
[2021-05-12 20:22:58,522] DEBUG - agent | Querying flow run metadata
[2021-05-12 20:22:58,538] INFO - agent | Found 1 flow run(s) to submit for execution.
[2021-05-12 20:22:58,538] DEBUG - agent | Next query for flow runs in 0.25 seconds
[2021-05-12 20:22:58,789] DEBUG - agent | Querying for flow runs
[2021-05-12 20:22:58,810] DEBUG - agent | Found flow runs ['734edd41-a9de-4ab9-86b4-aaf332fa1179'] (1 already submitting: ['734edd41-a9de-4ab9-86b4-aaf332fa1179'])
[2021-05-12 20:22:58,810] DEBUG - agent | Next query for flow runs in 0.5 seconds
[2021-05-12 20:22:59,311] DEBUG - agent | Querying for flow runs
[2021-05-12 20:22:59,331] DEBUG - agent | Found flow runs ['734edd41-a9de-4ab9-86b4-aaf332fa1179'] (1 already submitting: ['734edd41-a9de-4ab9-86b4-aaf332fa1179'])
[2021-05-12 20:22:59,331] DEBUG - agent | Next query for flow runs in 1.0 seconds
[2021-05-12 20:23:00,001] DEBUG - agent | Updating states for flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179
[2021-05-12 20:23:00,006] DEBUG - agent | Flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179 is in a Scheduled state, updating to Submitted
[2021-05-12 20:23:00,046] INFO - agent | Deploying flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179
[2021-05-12 20:23:00,050] DEBUG - agent | Submitted flow run 734edd41-a9de-4ab9-86b4-aaf332fa1179 to process PID 31690
[2021-05-12 20:23:00,068] DEBUG - agent | Completed flow run submission (id: 734edd41-a9de-4ab9-86b4-aaf332fa1179)
[2021-05-12 20:23:00,332] DEBUG - agent | Querying for flow runs
Zanie
Zanie
Max Lei
05/13/2021, 12:55 AMMax Lei
05/13/2021, 12:59 AMMax Lei
05/13/2021, 1:00 AMZanie
flow.run()
in your flow script?Zanie
if __name__ == "__main__":
block if soMax Lei
05/13/2021, 1:21 AMflow.run()
in the script, but it’s inside an if ___name___
. For example:
def run():
with Flow() as flow:
flow.run()
if __name__ == '__main__':
run()
Zanie
with Flow() as flow:
my_task()
if __name__ == '__main_':
flow.run()