Skip to content

Commit

Permalink
feat: Added print mechanism for exception on dump operation (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan authored Jul 9, 2024
1 parent a931f45 commit 987055b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions upsonic/remote/on_prem.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def __init__(self, api_url, access_key, engine="cloudpickle,dill", enable_usage_

self.thread_number = 5

def _send_request(self, method, endpoint, data=None, make_json=True):
def _send_request(self, method, endpoint, data=None, make_json=True, include_status=False):
try:
response = self.requests.request(
method,
Expand All @@ -225,7 +225,7 @@ def _send_request(self, method, endpoint, data=None, make_json=True):
f"[bold red]Error: {endpoint}",
)
else:
result = result["result"]
result = result["result"] if not include_status else result

return result
except: # pragma: no cover
Expand Down Expand Up @@ -826,10 +826,15 @@ def set(
"commit_message": message
}

response = self._send_request("POST", "/dump_together", data)
response = self._send_request("POST", "/dump_together", data, include_status=True)


if response != [None]:
return True
if response["status"] is False:
return response["result"]

if response["status"] is True:
return True
else:
return False

Expand Down

0 comments on commit 987055b

Please sign in to comment.