adamant-vase-85221
08/10/2023, 1:08 PM@conda / @conda_base decorators Metaflow has, but it leaves two questions open so far:
1. How to determine that workflow is being executed locally. So far I think that for local execution we would prefer just to build a virtual environment locally for each workflow step and use them (but this idea is also being evaluated right now)
2. How can this container build process be injected into the Metaflow "scheduling" process?
The image itself can be provided by the @kubernetes decorator, which can be applied on the fly to the workflow step, but I'm not sure yet, at what point we should build this image first.
I would appreciate any thoughts on this idea, thanks in advance 🙂ancient-application-36103
08/10/2023, 3:31 PM@kubernetes(image='foo')ancient-application-36103
08/10/2023, 3:32 PMadamant-vase-85221
08/10/2023, 3:44 PMYou can already supply a custom docker image usingI saw it, but I hadn't checked yet if it would be possible to run this workflow locally if the@kubernetes(image='foo')
@kubernetes decorator applied on it.
one straightforward mechanism for running locally in the same environment would be to create a venv and run the flow within that venvIdeally, I would love to have venv created on the fly, because it makes it a better developer experience. So my idea basically narrows to this pseudo-code decorator:
def dependencies(func, dependencies: Dict[str, str]):
qualified_name = f"{current.flow_name}-{current.step_name}-{hash(dependencies)}"
if current.runs_locally:
def wrapper():
venv.create(name=qualified_name)
venv.install_dependencies(dependencies)
func()
return wrapper
else:
def wrapper():
docker.build_image(name=qualified_name, from="python3.11:slim")
docker.push_image(name=qualified_name)
func = kubernetes(func, image=qualified_name)
return func
I hope it is clear enoughdry-beach-38304
08/10/2023, 4:53 PM