Brian Newman
11/14/2023, 7:24 PMMarvin
11/14/2023, 7:24 PMauto_remove: true
in your YAML file. This could be due to a variety of reasons. Let's try to troubleshoot:
1. Check Docker version: Ensure you're using a Docker version that supports the auto_remove
option. This feature was added in Docker API version 1.25 (Docker 1.13.0).
2. Correct Syntax: Make sure your YAML file is correctly formatted. The auto_remove
option should be under the container_config
section.
3. Running Containers: The auto_remove
option only removes containers after they have stopped running. If your container is still running, it won't be removed.
4. Error in Container: If the container encounters an error and stops, Docker might not remove it to allow you to investigate the error.
If none of these seem to be the issue, could you please share more details about your setup? That would help me assist you better.Brian Newman
11/14/2023, 7:28 PMdeployments:
- name: "dp_test::dev"
version: 1.0
description: ""
tags: ["dev"]
entrypoint: integrations/graph_api/deployments/check_microsoft_licenses.py:fl_check_microsoft_licenses
parameters: {"min_max_method": "maximum"}
work_pool:
name: azure-docker-pool
job_variables:
image: "<http://asdf.azurecr.io/asdf/prefect:dev|asdf.azurecr.io/asdf/prefect:dev>"
image_pull_policy: Always
env:
ENVIRONMENT: "dev"
PREFECT_LOGGING_LEVEL: "DEBUG"
auto_remove: true
schedule: *1st_of_month_at_7am
Marvin
11/14/2023, 7:28 PMauto_remove
option you're using is not in the correct place. In Prefect, the auto_remove
option is not a top-level configuration for a deployment. It should be under the run_config
section of a task, which specifies the Docker image to use when running the task.
Here's an example of how you might structure it:
yaml
from prefect import Flow, task
from prefect.run_configs import DockerRun
@task(run_config=DockerRun(auto_remove=True))
def my_task():
...
with Flow("My flow") as flow:
my_task()
In your case, you might need to adjust your Python scripts to include the auto_remove
option in the run_config
of your tasks.
Please note that this is a feature of Prefect 0.14.0 and later, so make sure your Prefect version is up to date.Brian Newman
11/14/2023, 7:30 PMMarvin
11/14/2023, 7:30 PMauto_remove
option is not directly available in the infrastructure block of a deployment. The infrastructure block is used to specify the infrastructure for flow runs created by the deployment at runtime.
However, you can specify the environment in which the flow executes when you run a flow directly by calling the flow yourself. This might be where you can use Docker's auto_remove
option.
For more specific details, I would recommend checking the Prefect documentation or their community forum. Here are the links to the pages I found:
- Infrastructure
- Automations
Please note that the information might not be complete as the excerpts are limited in length.