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

[ISSUE] Depreciated Endpoints to Retrieve Workspaces by AccountID for Azure #734

Open
ggkenios opened this issue Aug 22, 2024 · 0 comments

Comments

@ggkenios
Copy link

ggkenios commented Aug 22, 2024

Description
Endpoints for account > provisioning > workspaces are no longer supported for Azure (Only for AWS and GCP). More specifically:

Reproduction

     def get(self, workspace_id: int) -> Workspace:
        """Get a workspace.
        
        Gets information including status for a Databricks workspace, specified by ID. In the response, the
        `workspace_status` field indicates the current status. After initial workspace creation (which is
        asynchronous), make repeated `GET` requests with the workspace ID and check its status. The workspace
        becomes available when the status changes to `RUNNING`.
        
        For information about how to create a new workspace with this API **including error handling**, see
        [Create a new workspace using the Account API].
        
        This operation is available only if your account is on the E2 version of the platform or on a select
        custom plan that allows multiple workspaces per account.
        
        [Create a new workspace using the Account API]: http://docs.databricks.com/administration-guide/account-api/new-workspace.html
        
        :param workspace_id: int
          Workspace ID.
        
        :returns: :class:`Workspace`
        """

        headers = {'Accept': 'application/json', }

        res = self._api.do('GET',
                           f'/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}',
                           headers=headers)
        return Workspace.from_dict(res)

    def list(self) -> Iterator[Workspace]:
        """Get all workspaces.
        
        Gets a list of all workspaces associated with an account, specified by ID.
        
        This operation is available only if your account is on the E2 version of the platform or on a select
        custom plan that allows multiple workspaces per account.
        
        :returns: Iterator over :class:`Workspace`
        """

        headers = {'Accept': 'application/json', }

        res = self._api.do('GET', f'/api/2.0/accounts/{self._api.account_id}/workspaces', headers=headers)
        return [Workspace.from_dict(v) for v in res]

Expected behavior
Update the endpoint or catch the JSON decode error to let the user know that this is no longer available on Azure.

Is it a regression?
This worked a few days ago. SDK didn't change, but the endpoints are depreciated.

Debug Logs

  File "C:\Users\thxsg\.databricks\labs\ucx\lib\src\databricks\labs\ucx\account\metastores.py", line 41, in assign_metastore
    metastore_choices = self._get_all_metastores(self._get_region(workspace_id))
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\thxsg\.databricks\labs\ucx\lib\src\databricks\labs\ucx\account\metastores.py", line 58, in _get_region
    workspace = self._ac.workspaces.get(workspace_id)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\thxsg\.databricks\labs\ucx\state\venv\Lib\site-packages\databricks\sdk\service\provisioning.py", line 2626, in get
    res = self._api.do('GET',
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\thxsg\.databricks\labs\ucx\state\venv\Lib\site-packages\databricks\sdk\core.py", line 171, in do
    jsonResponse = response.json()
                   ^^^^^^^^^^^^^^^
  File "C:\Users\thxsg\.databricks\labs\ucx\state\venv\Lib\site-packages\requests\models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Other Information

  • OS: Windows
  • Version: 24H2

Additional context
Causing multiple issues working with the UCX tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant