Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Fails with "Asset is already in trash" #347

Closed
pohlposition opened this issue Sep 29, 2023 · 2 comments · Fixed by #367
Closed

Upgrade Fails with "Asset is already in trash" #347

pohlposition opened this issue Sep 29, 2023 · 2 comments · Fixed by #367
Assignees
Labels
bug Something isn't working feat/installer install/upgrade the app

Comments

@pohlposition
Copy link
Contributor

I installed the 0.1.1 release

  • everything installed correctly

I later downloaded the 0.2.0 release and ran install.sh again

The install failed with the following stacktrace

Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 547, in <module> installer.run() File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 77, in run self._run_configured() File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 80, in _run_configured self._create_dashboards() File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 106, in _create_dashboards self._dashboards["assessment"] = dash.create_dashboard() ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/framework/dashboards.py", line 110, in create_dashboard self._store_query_state(desired_queries) File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/framework/dashboards.py", line 189, in _store_query_state destructors[name](v) File "/private/var/folders/9l/118q49zs0kx7vs5qnwf9flc40000gp/T/tmp.ymyAK1W9/lib/python3.11/site-packages/databricks/sdk/service/sql.py", line 3021, in delete self._api.do('DELETE', f'/api/2.0/preview/sql/queries/{query_id}', headers=headers) File "/private/var/folders/9l/118q49zs0kx7vs5qnwf9flc40000gp/T/tmp.ymyAK1W9/lib/python3.11/site-packages/databricks/sdk/core.py", line 1084, in do raise self._make_nicer_error(status_code=response.status_code, **payload) from None databricks.sdk.core.DatabricksError: Asset is already in trash

@pohlposition pohlposition added bug Something isn't working feat/installer install/upgrade the app labels Sep 29, 2023
@pohlposition
Copy link
Contributor Author

That didn't format well. Raw text...

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 547, in
installer.run()
File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 77, in run
self._run_configured()
File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 80, in _run_configured
self._create_dashboards()
File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/install.py", line 106, in _create_dashboards
self._dashboards["assessment"] = dash.create_dashboard()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/framework/dashboards.py", line 110, in create_dashboard
self._store_query_state(desired_queries)
File "/Users/jason/git/ucx_releases/ucx-0.2.0/src/databricks/labs/ucx/framework/dashboards.py", line 189, in _store_query_state
destructorsname
File "/private/var/folders/9l/118q49zs0kx7vs5qnwf9flc40000gp/T/tmp.ymyAK1W9/lib/python3.11/site-packages/databricks/sdk/service/sql.py", line 3021, in delete
self._api.do('DELETE', f'/api/2.0/preview/sql/queries/{query_id}', headers=headers)
File "/private/var/folders/9l/118q49zs0kx7vs5qnwf9flc40000gp/T/tmp.ymyAK1W9/lib/python3.11/site-packages/databricks/sdk/core.py", line 1084, in do
raise self._make_nicer_error(status_code=response.status_code, **payload) from None
databricks.sdk.core.DatabricksError: Asset is already in trash

@FastLee
Copy link
Contributor

FastLee commented Oct 3, 2023

I did some analysis @nfx why are we deleting the queries in state.json and not just getting rid of the whole folder?

@nfx nfx closed this as completed in #367 Oct 3, 2023
github-merge-queue bot pushed a commit to databricks/databricks-sdk-py that referenced this issue Nov 13, 2023
… `BadRequest`, `PermissionDenied`, `InternalError`, and others (#376)

Improve the ergonomics of SDK, where instead of `except DatabricksError
as err: if err.error_code != 'NOT_FOUND': raise err else: do_stuff()` we
could do `except NotFound: do_stuff()`, like in [this
example](https://github.com/databrickslabs/ucx/blob/main/src/databricks/labs/ucx/workspace_access/generic.py#L71-L84).

Additionally, it'll make it easier to read stack traces, as they will
contain specific exception class name. Examples of unclear stack traces
are: databrickslabs/ucx#359,
databrickslabs/ucx#353,
databrickslabs/ucx#347,

# First principles
- ~~do not override `builtins.NotImplemented` for `NOT_IMPLEMENTED`
error code~~
- assume that platform error_code/HTTP status code mapping is not
perfect and in the state of transition
- we do represent reasonable subset of error codes as specific
exceptions
- it's still possible to access `error_code` from specific exceptions
like `NotFound` or `AlreadyExists`.

# Proposal
- have hierarchical exceptions, also inheriting from Python's built-in
exceptions
- more specific error codes override more generic HTTP status codes
- more generic HTTP status codes matched after more specific error
codes, where there's a default exception class per HTTP status code, and
we do rely on Databricks platform exception mapper to do the right
thing.
- have backward-compatible error creation for cases like using older
versions of the SDK on the way never releases of the platform.


![image](https://github.com/databricks/databricks-sdk-py/assets/259697/a4519f76-0778-468c-9bf5-6133984b5af7)

### Naming conflict resolution

We have four sources of naming and this is a proposed order of naming
conflict resolution:
1. Databricks `error_code`, that is surfaced in our API documentation,
known by Databricks users
2. HTTP Status codes, known by some developers
3. Python builtin exceptions, known by some developers
4. grpc error codes
https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto#L38-L185,
know by some developers

---------

Co-authored-by: Miles Yucht <miles@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feat/installer install/upgrade the app
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants