Hi, I'm trying to debug a flow locally and there s...
# prefect-community
j
Hi, I'm trying to debug a flow locally and there seems to be a crazy slowdown effect in running code via Prefect versus just a regular CLI. I am on Prefect Orion 2.0b8. Rough flow looks like
Copy code
@task
def update_task(file_type: str):
    update_files(file_type=file_type)

@flow
def update_flow(file_type: str):
    update_task(file_type=file_type)

if __name__ == '__main__':
    update_flow(file_type="incremental")
I am running it as
python -m tasks.prefect_flows.update_flow
. This takes 10+ minutes to run. By comparison, just running the same code with a click CLI takes 10s. Any idea what's going on?
1
Followup: I tried running it on Prefect 1.2.4 and it worked fine.
Is there a better way to debug Orion locally?
t
When working on 2.0b I recommend upgrading frequently as there have been a lot of breaking changes and fixed bugs in the past few weeks.
k
Let me know if that still works after you upgraded. If you still experience the same issue, you can set the logging level to debug to debug Orion locally
Copy code
export PREFECT_LOGGING_LEVEL='DEBUG'
t
Also, when it comes to debugging my flows locally, my fave method is adding
breakpoint()
(native python) inside my flow/task code then running the file
python flow_file.py
with a good ol’ if name == main block. That way I can step through each line.
j
Ok thank you both! I upgraded to 2.0b16 and it's fine.
marvin 3
@Taylor Curran that makes sense-- yeah I've been using pdb to step through as well. Just wanted to make sure the name == main way was ok! Appreciate both your help
t
step dancing