HI All, When I delete project with prefect client ...
# ask-community
m
HI All, When I delete project with prefect client API client.delete_project, The project is not deleted immediately. Has anyone experienced this before?
k
Hi @Milly gupta, does it get deleted eventually and how long is the gap you're experiencing?
m
Yes it does. The time varies sometimes between 1 minute to more than 3 mins. We have a retry behaviour to create the project if project is not deleted immediately but seeing many failures recently
k
Just confirming you're on Cloud right? Not server?
m
Yes using Prefect Cloud
k
Ok I'll reach out to the team and get back to you
m
Found another issue with create_project of project already exists. Clienterror is raising list index out of range error.
Copy code
Traceback (most recent call last):
File "/azp/local/python-venv/lib/python3.8/site-packages/prefect/client/client.py", line 971, in create_project
res = self.graphql(
File "/azp/local/python-venv/lib/python3.8/site-packages/prefect/client/client.py", line 319, in graphql
raise ClientError(result["errors"])
prefect.utilities.exceptions.ClientError: [{'path': ['create_project'], 'message': 'Uniqueness violation.', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/azp/local/LM-DataStrategy/python/cdppipeline/repos/lm_data_strategy.py", line 501, in <module>
run_pipeline()
File "/azp/local/python-venv/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/azp/local/python-venv/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/azp/local/python-venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/azp/local/python-venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/azp/local/LM-DataStrategy/python/cdppipeline/repos/lm_data_strategy.py", line 496, in run_pipeline
raise e
File "/azp/local/LM-DataStrategy/python/cdppipeline/repos/lm_data_strategy.py", line 493, in run_pipeline
_run_pipeline_steps(pipeline_steps)
File "/azp/local/LM-DataStrategy/python/cdppipeline/repos/lm_data_strategy.py", line 351, in _run_pipeline_steps
step_result = step.run()
File "/azp/local/LM-DataStrategy/python/cdppipeline/technologies/prefect_pipeline.py", line 36, in run
delete_and_create_project(
File "/azp/local/LM-DataStrategy/python/cdppipeline/technologies/prefect_pipeline.py", line 76, in delete_and_create_project
create_project(client=client, project_name=project_name)
File "/azp/local/LM-DataStrategy/python/cdppipeline/technologies/prefect_pipeline.py", line 61, in create_project
client.create_project(project_name=project_name)
File "/azp/local/python-venv/lib/python3.8/site-packages/prefect/client/client.py", line 991, in create_project
return res.data.project[0].id
File "/azp/local/python-venv/lib/python3.8/site-packages/box/box_list.py", line 68, in __getitem__
return super(BoxList, self).__getitem__(item)
IndexError: list index out of range
k
Ok will pass this over to the team also
m
@Kevin Kho Did you hear anything?
k
Yep, the team is working on it. Looks like we’ll need some changes on our end to bring that time down.
m
Thanks and what about error stack
k
Error stack is because you seem to be trying to create a project with the same name as the one you deleted, which is why there is a uniqueness violation. We’ll be updating the delete service on the backend today.
m
We have a project DEVTW/DEV seems stuck. Can't use them anymore.
k
By stuck you mean the project exists but you can’t add/remove flows?
m
We can't see the project with name DEVTW or DEV but not able to create it either
Our pipeline deletes the project and create again in DEV
On error, uniqueness violation is fine, but it's throwing index error as well with ClientError
k
Those two errors are related, and caused by the deletion not happening on the backend. Let me ask for a more specific timeline when our delete service will be working. Even if you don’t see it, the project name is still lingering around on our backend (our fault) and we’ll have to update our delete service to really get rid of it.
m
Yeah I gathered. but https://docs.prefect.io/api/latest/client/client.html#client-2 says create_project throws ClientError not Index error.
k
You got the ClientError above the Uniqueness violation. The index error is just a further traceback.
m
@Thomas Wilkins
k
Hey so this will be fixed in an hour. How often do your pipelines delete and create projects? If you do it repeatedly with a short interval, you may still run into issues because it can take upto a minute for the delete to go through
m
We have a CI/CD pipeline so merge to the main dev branch will trigger delete and create project. We have a retry behaviour with in our code to create project. How does customer's use normally?
k
You don’t need to delete and create the project. You can leave the project as it and just register flows there. Is there a need to delete everything?
m
Version will be upgraded right?
k
Version of the Flow will be upgraded yeah
m
Ok great thanks
@Kevin Kho Is this issue fixed?
k
It should be. Do you still see it?
m
Thanks @Kevin Kho. Tested last friday and it's working now.