Belal Aboabdo
05/10/2021, 6:10 PMprefect build -p
with the following error. Anyone experience this issue?
Beginning health checks...
System Version check: OK
Traceback (most recent call last):
File "/opt/prefect/healthcheck.py", line 150, in <module>
flows = import_flow_from_script_check(flow_file_paths)
File "/opt/prefect/healthcheck.py", line 63, in import_flow_from_script_check
flows.append(extract_flow_from_file(file_path=flow_file_path))
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/storage.py", line 86, in extract_flow_from_file
exec(contents, exec_vals)
File "<string>", line 129, in <module>
NameError: name '__file__' is not defined
Zanie
__file__
in your flow script?Belal Aboabdo
05/10/2021, 6:15 PMZanie
Belal Aboabdo
05/10/2021, 6:20 PMif __name__ == "__main__":
flow_params = dict(file_path=os.path.abspath(__file__))
FlowManager(flow, flow_params).do(entry_point())
Zanie
Zanie
flow.storage
)Belal Aboabdo
05/10/2021, 6:30 PMZanie
__name__
should not be __main__
when that flow is loadedZanie
__file__
else where in your flow code?Belal Aboabdo
05/10/2021, 6:40 PMZanie
from prefect import Flow
from prefect.storage import Docker as DockerStorage
with Flow("test") as flow:
pass
flow.storage = DockerStorage(base_image="prefecthq/prefect:0.14.7")
if __name__ == "__main__":
print(__file__)
works fine with prefect build -p
Belal Aboabdo
05/10/2021, 7:21 PMZanie
Belal Aboabdo
05/10/2021, 10:36 PMwith Flow(
flow_name,
**get_configs(
file_path=os.path.abspath(__file__), flow_name=flow_name, schedule=sched
),
) as flow:
Jacob Hayes
05/11/2021, 3:14 AM__file__
value rather than NameError
), but maybe this also has to do with how/if the flows are pickled?Zanie
__file__
in your flow declaration like that is a brittle case for us to handle. I'll open an issue to look into it further nonetheless.Zanie
__file__
in flow"Marvin
05/11/2021, 2:56 PMBelal Aboabdo
05/11/2021, 4:24 PM