Unable to delete an existing environment in v2.6
Describe the bug
Getting above error when trying to delete an environment
How to Reproduce
Delete an existing environment through data.all UI ( Using v2.6 )
Expected behavior
Env should get deleted
Your project
No response
Screenshots
No response
OS
Mac
Python version
3.9
AWS data.all version
2.6
Additional context
No response
Hi @TejasRGitHub - I can not seem to replicate the above when I try to delete an environment I provisioned in v2.6
Could you give soem additional context on
- Teams or Consumption Roles invited to the Env?
- Existing Shares or Datasets on the Env?
- Existing Env Features Enabled and any Play Tool resources created on the env?
Any type of log outputs on the delete operation that could help identify what is impacting the delete behavior
Adding additional docs that may prove helpful in debugging the above if can determine root cause https://stackoverflow.com/questions/49794899/flask-sqlalchemy-delete-query-failing-with-could-not-evaluate-current-criteria
Doing a bit more digging on the above - if I had to guess I would imagine that your environment has existing sahre objects that are not in a share state
and that the error is being thrown at dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py::delete_all_S3_share_items when trying to handle a filter expression using .in_(...) and deleting all share object items
I will try to find some time to test out the above theory - please confirm if the above matches your set up of your environment
Hi @TejasRGitHub - I can not seem to replicate the above when I try to delete an environment I provisioned in v2.6
Could you give soem additional context on
- Teams or Consumption Roles invited to the Env?
There is only one team which is the environment admin team
- Existing Shares or Datasets on the Env?
No datasets and no shared made on this environment
- Existing Env Features Enabled and any Play Tool resources created on the env?
None environment play features are enabled
Any type of log outputs on the delete operation that could help identify what is impacting the delete behavior
Here's the stack trace
1722262247452,"GraphQL request:2:3
"
1722262247452,"1 | mutation deleteEnvironment($environmentUri: String!, $deleteFromAWS: Boolean) {
"
1722262247452,"2 | deleteEnvironment(
"
1722262247452,"| ^
"
1722262247452,"3 | environmentUri: $environmentUri
"
1722262247452,"Traceback (most recent call last):
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py"", line 1763, in _do_pre_synchronize
"
1722262247452,"eval_condition = evaluator_compiler.process(query.whereclause)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 64, in process
"
1722262247452,"return meth(clause)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 108, in visit_clauselist
"
1722262247452,"evaluators = list(map(self.process, clause.clauses))
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 64, in process
"
1722262247452,"return meth(clause)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 141, in visit_binary
"
1722262247452,"eval_left, eval_right = list(
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 64, in process
"
1722262247452,"return meth(clause)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 67, in visit_grouping
"
1722262247452,"return self.process(clause.element)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 64, in process
"
1722262247452,"return meth(clause)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/evaluator.py"", line 134, in visit_clauselist
"
1722262247452,"raise UnevaluatableError(
"
1722262247452,"sqlalchemy.orm.evaluator.UnevaluatableError: Cannot evaluate clauselist with operator <function comma_op at 0x7efced992820>
"
1722262247452,"The above exception was the direct cause of the following exception:
"
1722262247452,"Traceback (most recent call last):
"
1722262247452,"File ""/usr/local/lib/python3.9/site-packages/graphql/execution/execute.py"", line 521, in execute_field
"
1722262247452,"result = resolve_fn(source, info, **args)
"
1722262247452,"File ""/home/app/dataall/base/api/__init__.py"", line 55, in adapted
"
1722262247452,"response = resolver(
"
1722262247452,"File ""/home/app/dataall/core/environment/api/resolvers.py"", line 234, in delete_environment
"
1722262247452,"session_response, environment = EnvironmentService.delete_environment(uri=environmentUri)
"
1722262247452,"File ""/home/app/dataall/core/permissions/services/resource_policy_service.py"", line 270, in wrapper
"
1722262247452,"return f(*args, **kwargs)
"
1722262247452,"File ""/home/app/dataall/core/environment/services/environment_service.py"", line 886, in delete_environment
"
1722262247452,"EnvironmentResourceManager.delete_env(session, environment)
"
1722262247452,"File ""/home/app/dataall/core/environment/services/environment_resource_manager.py"", line 59, in delete_env
"
1722262247452,"resource.delete_env(session, environment)
"
1722262247452,"File ""/home/app/dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py"", line 38, in delete_env
"
1722262247452,"S3ShareObjectRepository.delete_all_S3_share_items(session, environment.environmentUri)
"
1722262247452,"File ""/home/app/dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py"", line 88, in delete_all_S3_share_items
"
1722262247452,"session.query(ShareObjectItem)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/query.py"", line 3926, in delete
"
1722262247452,"delete_op.exec_()
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py"", line 1696, in exec_
"
1722262247452,"self._do_pre_synchronize()
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py"", line 1772, in _do_pre_synchronize
"
1722262247452,"util.raise_(
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/util/compat.py"", line 182, in raise_
"
1722262247452,"raise exception
"
1722262247452,"sqlalchemy.exc.InvalidRequestError: Could not evaluate current criteria in Python: ""Cannot evaluate clauselist with operator <function comma_op at 0x7efced992820>"". Specify 'fetch' or False for the synchronize_session parameter.
"
1722262247452,"The above exception was the direct cause of the following exception:
"
1722262247452,"Traceback (most recent call last):
"
1722262247452,"File ""/usr/local/lib/python3.9/site-packages/graphql/execution/execute.py"", line 521, in execute_field
"
1722262247452,"result = resolve_fn(source, info, **args)
"
1722262247452,"File ""/home/app/dataall/base/api/__init__.py"", line 55, in adapted
"
1722262247452,"response = resolver(
"
1722262247452,"File ""/home/app/dataall/core/environment/api/resolvers.py"", line 234, in delete_environment
"
1722262247452,"session_response, environment = EnvironmentService.delete_environment(uri=environmentUri)
"
1722262247452,"File ""/home/app/dataall/core/permissions/services/resource_policy_service.py"", line 270, in wrapper
"
1722262247452,"return f(*args, **kwargs)
"
1722262247452,"File ""/home/app/dataall/core/environment/services/environment_service.py"", line 886, in delete_environment
"
1722262247452,"EnvironmentResourceManager.delete_env(session, environment)
"
1722262247452,"File ""/home/app/dataall/core/environment/services/environment_resource_manager.py"", line 59, in delete_env
"
1722262247452,"resource.delete_env(session, environment)
"
1722262247452,"File ""/home/app/dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py"", line 38, in delete_env
"
1722262247452,"S3ShareObjectRepository.delete_all_S3_share_items(session, environment.environmentUri)
"
1722262247452,"File ""/home/app/dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py"", line 88, in delete_all_S3_share_items
"
1722262247452,"session.query(ShareObjectItem)
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/query.py"", line 3926, in delete
"
1722262247452,"delete_op.exec_()
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py"", line 1696, in exec_
"
1722262247452,"self._do_pre_synchronize()
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py"", line 1772, in _do_pre_synchronize
"
1722262247452,"util.raise_(
"
1722262247452,"File ""/usr/local/lib64/python3.9/site-packages/sqlalchemy/util/compat.py"", line 182, in raise_
"
1722262247452,"raise exception
"
1722262247452,"graphql.error.graphql_error.GraphQLError: Could not evaluate current criteria in Python: ""Cannot evaluate clauselist with operator <function comma_op at 0x7efced992820>"". Specify 'fetch' or False for the synchronize_session parameter.
"
Doing a bit more digging on the above - if I had to guess I would imagine that your environment has existing sahre objects that are not in a share state
and that the error is being thrown at
dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py::delete_all_S3_share_itemswhen trying to handle a filter expression using.in_(...)and deleting all share object itemsI will try to find some time to test out the above theory - please confirm if the above matches your set up of your environment
Hi @noah-paige , the environment doesn't have any dataset and also there aren't any shared objects
from stack trace looks like it is an issue from delete_all_S3_share_items
however - I am not able to replicate the same behavior in my data.all which is very strange
Also I do believe there must be shares because the code that is executed and causing the error is only executed if there exists shares requested to the env trying to delete, for example:
backend/dataall/modules/s3_datasets_shares/db/s3_share_object_repositories.py:
env_shared_with_objects = session.query(ShareObject).filter(ShareObject.environmentUri == env_uri).all()
for share in env_shared_with_objects:
...
Hi @noah-paige ,
Your diagnostics was right . There was a draft share request which was not showing up the share's page. After deleting it manually I was able to delete the share request
Here are the steps to reproduce it.
- Create an environment
- Invite team to that environment
- Create a draft share request with the newly added team to a dataset
- Delete the team from the environment. Team gets deleted even when a draft share request is present
- Delete the environment