Hello, I'm trying to remove workers from a work-po...
# ask-community
u
Hello, I'm trying to remove workers from a work-pool. What I've tried so far: • Remove them in Prefect Cloud but when I create a new one, the deleted one shows up again along with the new one like if they were duplicated. • Remove the work-pool and re-created it. After recreating a new worker, I see a gain duplicated workers in the UI. I'm out of solutions. Thanks for your help
j
Hey, do you still have that worker actually running somewhere? I believe that list of workers is populated by heartbeats of workers actively polling the workpool?
u
I have the new worker living in GCP but 4 in the UI 😮 2 are associated (somehow) to my cloud run service active and the other 2 are the legacy ones from the work pool I deleted before.
For each test of worker deletion I delete the service in cloud run before re-creating the new worker btw
j
Can you open the network tab and confirm you see a successful 204 from the API when deleting the legacy ones? If I'm understanding right you do this and then they come back automatically?
u
@Jake Kaplan I see a successful 204 from the API. The problem is when I delete the last one (currently active). If I delete the cloud run service and I delete the worker in Prefect Cloud (204 code) I don't think it's really delete. When I'm re-creating the worker using the CLI (using the same name), the new cloud run service is created on GCP side and in the Prefect Cloud UI 2 workers show up at the same time.
j
So the name is uniquely generated at start time of the worker process, unless you pass
prefect worker start --name <my_worker>
, is it possible that the cloud run service is scaling multiple containers? If the names are different than each other (and the old names) that would be my next guess. If it was a restart, that would be a "different worker" but I wouldn't expect them to both be
Online
u
I'm actually following the official tutorial here. I'm don't see the command you're mentioning above since it's said to use:
Copy code
gcloud run deploy prefect-worker --image=prefecthq/prefect:3-latest \
--set-env-vars PREFECT_API_URL=$PREFECT_API_URL,PREFECT_API_KEY=$PREFECT_API_KEY \
--service-account <YOUR-SERVICE-ACCOUNT-NAME> \
--no-cpu-throttling \
--min-instances 1 \
--startup-probe httpGet.port=8080,httpGet.path=/health,initialDelaySeconds=100,periodSeconds=20,timeoutSeconds=20 \
--args "prefect","worker","start","--install-policy","always","--with-healthcheck","-p","<WORK-POOL-NAME>","-t","cloud-run"
j
If you wanted to specify a name it would go in the
--args
Copy code
--args "prefect","worker","start", ... , "--name", "my_worker"
Can you try setting that and see if you're still seeing multiple? It may be a clue to what's going on.
u
I'm gonna try that tomorrow and let you know. Thanks!
Just a heads up on this, I haven't test it out yet because my worker seems to work now but if I need to create a new one I'll try your solution and let you know if this thread. Thank you.
šŸ™Œ 1
šŸ‘ 1