microsoft / semantic-link-labs

Early access to new features for Microsoft Fabric's Semantic Link.
MIT License
178 stars 37 forks source link

update from Git #184

Closed muhssamy closed 1 month ago

muhssamy commented 1 month ago

i am using the following code to update from git and it is actually works and the target workspace has been updated.

but i am getting an error after that The operation has no result

labs.update_from_git(
    workspace=workspace,
    remote_commit_hash = remote_commit_hash,
    conflict_resolution_policy = 'PreferRemote',
    workspace_head = workspace_head,
    allow_override = False
)

error

---------------------------------------------------------------------------
FabricHTTPException                       Traceback (most recent call last)
Cell In[49], line 1
----> 1 labs.update_from_git(
      2     workspace=workspace,
      3     remote_commit_hash = remote_commit_hash,
      4     conflict_resolution_policy = 'PreferRemote',
      5     workspace_head = workspace_head,
      6     allow_override = False
      7                         )

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy_labs/_git.py:375, in update_from_git(remote_commit_hash, conflict_resolution_policy, workspace_head, allow_override, workspace)
    372 if response.status_code not in [200, 202]:
    373     raise FabricHTTPException(response)
--> 375 lro(client, response)
    377 print(
    378     f"{icons.green_dot} The '{workspace}' workspace has been updated with commits pushed to the connected branch."
    379 )

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy_labs/_helper_functions.py:896, in lro(client, response, status_codes, sleep_time, return_status_code)
    894         result = response.status_code
    895     else:
--> 896         response = client.get(f"/v1/operations/{operationId}/result")
    897         result = response
    899 return result

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy/fabric/_client/_rest_client.py:144, in BaseRestClient.get(self, path_or_url, *args, **kwargs)
    125 def get(self, path_or_url: str, *args, **kwargs):
    126     """
    127     GET request to the Fabric and PowerBI REST API.
    128 
   (...)
    142         The response from the REST API.
    143     """
--> 144     return self.request("GET", path_or_url, *args, **kwargs)

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy/fabric/_client/_rest_client.py:305, in FabricRestClient.request(self, method, path_or_url, lro_wait, lro_max_attempts, lro_operation_name, *args, **kwargs)
    272 def request(self,
    273             method: str,
    274             path_or_url: str,
   (...)
    278             *args,
    279             **kwargs):
    280     """
    281     Request to the Fabric REST API.
    282 
   (...)
    303         The response from the REST API.
    304     """
--> 305     response = super().request(method, path_or_url, *args, **kwargs)
    307     if not lro_wait or response.status_code != 202:
    308         return response

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy/fabric/_client/_rest_client.py:123, in BaseRestClient.request(self, method, path_or_url, *args, **kwargs)
    120 kwargs["url"] = url
    121 kwargs["headers"] = headers
--> 123 return self.http.request(method, *args, **kwargs)

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/requests/sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    584 send_kwargs = {
    585     "timeout": timeout,
    586     "allow_redirects": allow_redirects,
    587 }
    588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
    591 return resp

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/requests/sessions.py:710, in Session.send(self, request, **kwargs)
    707 r.elapsed = timedelta(seconds=elapsed)
    709 # Response manipulation hooks
--> 710 r = dispatch_hook("response", hooks, r, **kwargs)
    712 # Persist cookies
    713 if r.history:
    714 
    715     # If the hooks create history then we want those cookies too

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/requests/hooks.py:30, in dispatch_hook(key, hooks, hook_data, **kwargs)
     28     hooks = [hooks]
     29 for hook in hooks:
---> 30     _hook_data = hook(hook_data, **kwargs)
     31     if _hook_data is not None:
     32         hook_data = _hook_data

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy/_utils/_log.py:273, in mds_log.<locals>.get_wrapper.<locals>.log_decorator_wrapper(*args, **kwargs)
    270     raise
    272 try:
--> 273     result = func(*args, **kwargs)
    275     # The invocation for get_message_dict moves after the function
    276     # so it can access the state after the method call
    277     message.update(extractor.get_completion_message_dict(result, arg_dict))

File ~/cluster-env/clonedenv/lib/python3.10/site-packages/sempy/fabric/_client/_rest_client.py:64, in BaseRestClient.__init__.<locals>.validate_rest_response(response, *args, **kwargs)
     61 @log_rest_response
     62 def validate_rest_response(response, *args, **kwargs):
     63     if response.status_code >= 400:
---> 64         raise FabricHTTPException(response)

FabricHTTPException: 400 Bad Request for url: https://api.fabric.microsoft.com//v1/operations/c25a8059-855f-4bbe-b5c5-659208c4f270/result
Error: {"requestId":"e1e5098d-6916-45d7-bcde-671683f84a36","errorCode":"OperationHasNoResult","message":"The operation has no result"}
Headers: {'Cache-Control': 'no-store, must-revalidate, no-cache', 'Pragma': 'no-cache', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-public-api-error-code': 'OperationHasNoResult', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'RequestId': 'e1e5098d-6916-45d7-bcde-671683f84a36', 'Access-Control-Expose-Headers': 'RequestId', 'request-redirected': 'true', 'home-cluster-uri': 'https://wabi-west-europe-redirect.analysis.windows.net/', 'Date': 'Thu, 03 Oct 2024 08:53:27 GMT'}
m-kovalsky commented 1 month ago

Making a fix to resolve this. Thanks for raising the issues, I very much appreciate it.

m-kovalsky commented 1 month ago

Fixed in 0.8.3.