Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diptanu committed Dec 2, 2024
1 parent 461c3c8 commit bb2f134
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 234 deletions.
16 changes: 7 additions & 9 deletions python-sdk/indexify/executor/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,31 @@ async def download_input(self, task: Task) -> DownloadedInputs:
if response.headers["content-type"] == JsonSerializer.content_type
else "cloudpickle"
)
serializer = get_serializer(encoder)

if task.invocation_id == input_id:
return DownloadedInputs(
input=IndexifyData(
payload=response.content, id=input_id, encoder=encoder
),
)

deserialized_content = serializer.deserialize(response.content)
input_payload = response.content

if reducer_url:
init_value = self._client.get(reducer_url)
response = self._client.get(reducer_url)
try:
init_value.raise_for_status()
response.raise_for_status()
init_value = response.content
except httpx.HTTPStatusError as e:
logger.error(
"failed to download reducer output",
url=reducer_url,
error=init_value.text,
error=response.text,
)
raise
init_value = serializer.deserialize(init_value.content)
return DownloadedInputs(
input=IndexifyData(
input_id=task.invocation_id,
payload=deserialized_content,
payload=input_payload,
encoder=encoder,
),
init_value=IndexifyData(
Expand All @@ -122,7 +120,7 @@ async def download_input(self, task: Task) -> DownloadedInputs:
return DownloadedInputs(
input=IndexifyData(
input_id=task.invocation_id,
payload=deserialized_content,
payload=input_payload,
encoder=encoder,
)
)
8 changes: 5 additions & 3 deletions python-sdk/indexify/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,12 @@ def _download_output(
)
response.raise_for_status()
content_type = response.headers.get("Content-Type")
serializer = get_serializer(content_type)
decoded_response = serializer.deserialize(response.content)
if content_type == "application/octet-stream":
encoding = "cloudpickle"
else:
encoding = "json"
return IndexifyData(
id=output_id, payload=decoded_response, encoder=serializer.encoding_type
id=output_id, payload=response.content, encoder=encoding
)

def graph_outputs(
Expand Down
Loading

0 comments on commit bb2f134

Please sign in to comment.