<@ULVA73B9P>, how to delete a worker?
# ask-marvin
a
@Marvin, how to delete a worker?
m
thought for 77.6 seconds
Based on the research, here's how you can stop/delete a worker: 1. If running in the terminal (most common case): - Press
Ctrl+C
in the terminal where the worker is running - Or find the process ID (PID) and use the
kill
command:
Copy code
bash
     # Find the worker process
     ps aux | grep "prefect worker"
     
     # Kill the process gracefully (replace PID with the actual process ID)
     kill PID
2. If running as a service or in a container: - If using Docker:
docker stop <container-name>
- If using systemd:
sudo systemctl stop prefect-worker
- If using Kubernetes:
kubectl delete pod <worker-pod-name>
The worker will perform a graceful shutdown when it receives the termination signal. After about 90 seconds of no heartbeat, the Prefect server will mark the worker as offline. Note that there's no specific CLI command to delete a worker - workers are ephemeral processes that you simply stop when you no longer need them. If you want to remove a work pool instead (which workers connect to), that's a different command and I can provide those instructions if needed. Would you like me to provide more specific instructions for your particular setup (Docker, Kubernetes, local process, etc.)?
a
throug yaml deployment?