You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a process worker is shut down, any flows it was running at the time stay in the "Running" state indefinitely. If the work pool has a concurrency limit, that limit is effectively reduced by the number of hanging flows.
To reproduce:
Install docker and docker compose
Copy the files below into the same directory
Run docker compose up. If this fails, it is probably because the database didn't have enough time to initialize. Simply wait a few seconds and run docker compose up again.
Wait for a flow run to be triggered and for the worker to start it.
While the flow is still running, hit Ctrl-C to stop the containers.
Run docker compose up again and wait for everything to initialize.
View the Prefect server UI at http://localhost:4200. You will see a "Running" task that never ends. Over time, new scheduled flows will be added but they will never run because the work pool has a concurrency limit of 1.
# Welcome to your prefect.yaml file! You can use this file for storing and managing
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.
# Generic metadata about this project
name: prefect_deployments
prefect-version: 3.1.12
# build section allows you to manage and build docker images
build: null
# push section allows you to manage if and how this project is uploaded to remote locations
push: null
# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.set_working_directory:
directory: /data
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: "test_deployment"
version: "1"
tags: []
description: "Run the test flow"
schedule:
interval: 20
flow_name: "test_flow"
entrypoint: /data/flows.py:test_flow
parameters: {}
work_pool:
name: "test_pool"
work_queue_name: "test_pool"
job_variables: {}
flows.py:
from prefect import flow
from time import sleep
@flow
def test_flow():
print("Running flow")
sleep(15)
Describe the proposed behavior
When a process worker crashes or is shut down gracefully, mark any flows it was running as "Crashed".
Example Use
This is a common problem during development when using docker compose to bring up/shut down a development stack with long running processes. Anything that is still running at the time docker compose down is executed will hang indefinitely.
Our current recommendation for these situations is to setup a zombie-killer automation as described here: https://docs.prefect.io/v3/automate/events/automations-triggers#detect-and-respond-to-zombie-flows
It was actually an intentional design decision to not couple submitted work to worker health as a form of fault tolerance, but honestly this decision doesn't make much sense for the Process Worker specifically because the work is in fact coupled; I think we can look to add an attempt to cancel subprocesses when that particular worker shuts down gracefully.
The text was updated successfully, but these errors were encountered:
Describe the current behavior
When a process worker is shut down, any flows it was running at the time stay in the "Running" state indefinitely. If the work pool has a concurrency limit, that limit is effectively reduced by the number of hanging flows.
To reproduce:
docker compose up
. If this fails, it is probably because the database didn't have enough time to initialize. Simply wait a few seconds and rundocker compose up
again.Ctrl-C
to stop the containers.docker compose up
again and wait for everything to initialize.Files used (put these in the same directory):
docker-compose.yml:
prefect.yaml:
flows.py:
Describe the proposed behavior
When a process worker crashes or is shut down gracefully, mark any flows it was running as "Crashed".
Example Use
This is a common problem during development when using docker compose to bring up/shut down a development stack with long running processes. Anything that is still running at the time
docker compose down
is executed will hang indefinitely.Additional context
Some context from @cicdw on Slack:
The text was updated successfully, but these errors were encountered: