Skip to content

Commit

Permalink
Faster dump with dump_together api
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed May 24, 2024
1 parent 235c5dc commit 2f91f9e
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions upsonic/remote/on_prem.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,20 +709,12 @@ def set(

encryption_key = "u"

data = {
"scope": key,
"code": textwrap.dedent(self.extract_source(value)),
}

self._send_request("POST", "/dump_code", data)
the_code = textwrap.dedent(self.extract_source(value))





data = {"scope": key, "type": the_type}

self._send_request("POST", "/dump_type", data)


the_requirements = Upsonic_On_Prem.export_requirement()
Expand Down Expand Up @@ -763,21 +755,11 @@ def set(

if self.tester:
self._log(f"the_original_requirements {the_original_requirements}")
data = {
"scope": key,
"requirements": the_original_requirements,
}

self._send_request("POST", "/dump_requirements", data)

the_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"


data = {
"scope": key,
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
}

self._send_request("POST", "/dump_python_version", data)

fernet_key = base64.urlsafe_b64encode(hashlib.sha256(encryption_key.encode()).digest())
fernet = Fernet(fernet_key)
Expand Down Expand Up @@ -828,11 +810,15 @@ def set(

data = {
"scope": key,
"code": the_code,
"type": the_type,
"requirements": the_original_requirements,
"python_version": the_version,
"data": fernet.encrypt(dumped),
"commit_message": message
}

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

if response != [None]:
return True
Expand Down

0 comments on commit 2f91f9e

Please sign in to comment.