We want to be able to turn any function into singl...
# prefect-community
j
We want to be able to turn any function into single-task flows. I’ve created a wrapper to do this (as pictured). Calling
.run()
on the flow that gets returned works fine, and registering the flow seems to be fine too (using k8s run). However, when we try to actually run it, we get the following error:
Copy code
Failed to load and execute flow run: FlowStorageError('An error occurred while unpickling the flow:\n  ModuleNotFoundError("No module named \'build_index\'")\nThis may be due to a missing Python module in your current environment. Please ensure you have all required flow dependencies installed.')
Am I missing something obvious?
k
Do you recognize
build_index
? I don’t know where that is from
j
That’s used by the function I’m passing into the wrapper
flow = make_into_flow(flow_name, build_index_from_cache
and we have
from directory.build_index import build_index_from_cache
k
Ah then that just needs to be available in the execution environment for that it’s understood when unpickled
j
How do I make that available? It should already exist in the docker image
k
It seems like it can’t resolve the import though. Either add it to PYTHONPATH or install it as a library with pip? Have you done that before?