Hi, i have a flow with docker storage in ECR and a...
# ask-community
n
Hi, i have a flow with docker storage in ECR and a KubernetesRun with image_pull_policy Always , i have an agent running on my EKS cluster, for some reason when i change the flow code and builds a new image and run the flow from cloud, the flow runs with the old image, i validated this when i change the image tag then the new code is used, any clues how to solve this?
k
Can I see how you set up KubernetesRun?
n
flow.run_config = KubernetesRun( image=‘*************.dkr.ecr.us-west-2.amazonaws.com/semantic-layer:copy_semantic_views_to_snowflake2’, image_pull_policy=“Always” )
k
This looks good to me. Will ask the team for any ideas
Hey, would you be able to check if the `image_pull_policy`is applied to the job that the agent created?
b
I may have run into the same issue in GKE: https://github.com/PrefectHQ/prefect/issues/4939
k
Ok I’ll try this tom
z
@Brad I a couple questions to help in debugging • are you defining anything on your Kubernetes Agent? (e.g. a job template?) • how exactly are you running the flow? (UI, CLI, via a Schedule) • if running the flow in the UI, how exactly are you creating the flow run?
b
Hi @Zach Angell • We are deploying the standard agent yaml config from the command:
prefect agent kubernetes install
• No custom job template •
IMAGE_PULL_POLICY
is left blank (assume that means
IfNotPresent
) • We are running the flow both from the UI and API • In the UI, select the flow, click ‘Run’, setting our run inputs, and clicking ‘Run’ • API is similar, sending the input dictionary to the
create_flow_run
mutation • The
KubernetesRun
config is set on registration and everything works except the
image_pull_policy
flag
z
Thank you for the detail here! For the UI, is image pull policy respected if you just click "Quick Run"? For the API, could you share the
create_flow_run
mutation you're using? (Feel free to DM instead of post in the thread)
I haven't had a chance to test, but for the UI I suspect we need to add an "Image Pull Policy" field to the "Run" tab. If you edit the flow's run config while creating a flow run, it will overwrite the run config specified at registration. For the API, it's possible the Flow Group's run config is overriding the Flow's run config. Although this is not a common scenario. If you specify the full
run_config
in
create_flow_run
, I would expect it to respect the
image_pull_policy
argument
b
I can try that from the API, we currently don’t override anything other than the input parameters when creating a run since the client doesn’t know the correct backend environment variables to use. Our query looks like:
Copy code
const query = gql`
      mutation ($input: create_flow_run_input!) {
        create_flow_run(input: $input) {
          id
        }
      }
    `;

    const variables = {
      input,
    };
Where the input is defined like:
Copy code
parameters = {
        some_var: 42,
        uuid: fileId,
}
In general, we don’t really want our users to have to configure every run_config parameter and should just use the default that the flow was registered with (just like all the default env vars we set).
z
In general, we don’t really want our users to have to configure every run_config parameter and should just use the default that the flow was registered with
Understood and 100% agree that is how the system should work. For the UI, we need to add a new field. I've opened an issue here https://github.com/PrefectHQ/ui/issues/1040. For the API, I can do some further testing. Could you DM me the ID of your Flow and Flow Group? Both can be found in the "Flow" page -> "Overview" tab -> "Details" option on the "Overview" tile"
@Brad I I did some testing against the API and I'm not able to reproduce the issue you're seeing. Unless
run_config
is provided as an input to
create_flow_run
, Prefect should use the Flow's run config. I've also confirmed the Flow Group does not have a
run_config
that would be overriding this behavior. The UI definitely has a bug, but I'm a bit perplexed on the API behavior
b
Thanks @Zach Angell, we’ve been doing a lot of testing just from the UI, so I’ll double check from the API today.
👍 1