is there a way to edit the command on k8s jobs? it...
# prefect-server
d
is there a way to edit the command on k8s jobs? it's
prefect execute flow-run
but I want to add a command before that
k
Hey @Dana Merrick, AFAIK not via the CLI, that command would simply run a flow against your backend API with the supplied
run_config
determining the k8s job. Looking through the CLI flags, you may be able to parameterize your job config and select it with a flag, but this would likely be specific to your use case.
d
basically what is happening is we use
conda
to install our packages, but conda needs
conda activate <env name>
to run before
prefect
runs
in most of our docker containers we run
conda activate <env> && <command>
but it appears that prefect hardcodes the command and doesnt let us change it, even with a custom k8s job template 😞
🤔 1
here's where it's hardcoded:
k
hmm, I’m surprised this isn’t honored by the image nor the job template… I think we’re looking for something to the equivalent of the
on_start
from the old KubernetesJobEnvironment days, but I’m still looking for a
run_config
solution - I must be missing something.
d
yeah, it looks like the steps are: prefect-agent (running in pod on k8s) picks up flow, it uses the user-provided job-template as a starting point, and then overlays some settings on top of it before sending to k8s to be created as a Job
so even if i set the args in my template, the prefect code overrides it
k
Hey Dana - check out this issue on GH, in which Jim’s comment provides an example of using an entrypoint for the Dockerfile (in our case something like a
conda run
 CLI) and an explanation for this behavior. I hope this may shed some light on this, but please feel free to comment there with your thoughts.
👀 1
d
this helped me btw, thanks!