:wave: My flow is a part of a python package and u...
# prefect-community
q
👋 My flow is a part of a python package and uses utility functions which are also a part of the package (e.g.
projname/flows/myflow.py
imports
projname.utils.utilfunc
). This flow is scheduled from a deployment and uses
Process
as its infrastructure block. I would like to ensure that the latest version of
projname
is installed (to guarantee that
utilfunc
is up-to-date), so I can't install the package when setting up agent environment. I think I can install the package before running the flow if I set
Process.command
to something like
["pip", "install", ".", "&&", "python3", "-m", "prefect.engine"]
, but maybe there's a better way to go about it?
k
that sounds like a good approach to me. Is there a reason why you don’t want to set up the command that way?
q
No reason, just checking in case I'm missing something 🙂
👍 1
Finally got around to trying it, can't find a way to make it work. I don't think there is a way to execute multiple commands without setting
shell=True
.
anyio sets
shell=True
if isinstance(command, str)
, but currently command is restricted to
List[str]
.
Looking at it a bit further, I don't think this could possibly work even if you could pass a proper command. I thought code gets fetched somewhere in Infrastructure block, but it actually gets fetched by
prefect.engine
. So there's no way to do something that involves source files before running
python3 -m prefect.engine
and I don't think there's a way to modify what happens there. Welp.
k
Do you mean that the command
["pip", "install", ".", "&&", "python3", "-m", "prefect.engine"]
doesn’t work?
q
Disregard the first part of the previous comment. The way to go about executing multiple commands with
shell=False
is
command=["/bin/bash", "-c", "cmd1 args1 && cmd2 args2"]
Doesn't really solve my problem, but figured that out at least.