From f298e4db51659bbf0b669f301b1db051fd42721f Mon Sep 17 00:00:00 2001 From: Marius Merschformann Date: Fri, 16 Feb 2024 03:14:20 +0100 Subject: [PATCH 1/3] Fix download of large results --- nextmv/cloud/application.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nextmv/cloud/application.py b/nextmv/cloud/application.py index 3a17921..bce891b 100644 --- a/nextmv/cloud/application.py +++ b/nextmv/cloud/application.py @@ -5,6 +5,8 @@ from datetime import datetime from typing import Any +import requests + from nextmv.base_model import BaseModel from nextmv.cloud.acceptance_test import AcceptanceTest, Metric from nextmv.cloud.batch_experiment import BatchExperiment, BatchExperimentMetadata, BatchExperimentRun @@ -717,13 +719,13 @@ def _run_result( endpoint=f"{self.endpoint}/runs/{run_id}", query_params=query_params, ) + result = RunResult.from_dict(response.json()) if not large_output: - return RunResult.from_dict(response.json()) + return result - download_url = DownloadURL.from_dict(response.json()) - response2 = self.client.request( - method="GET", - endpoint=download_url.url, - ) + download_url = DownloadURL.from_dict(response.json()["output"]) + download_response = requests.get(download_url.url) + download_response.raise_for_status() + result.output = download_response.json() - return RunResult.from_dict(response2.json()) + return result From 84e001bebc354a4c6f5195d80b4ec16468982284 Mon Sep 17 00:00:00 2001 From: Marius Merschformann Date: Fri, 16 Feb 2024 17:31:34 +0100 Subject: [PATCH 2/3] Update nextmv/cloud/application.py Co-authored-by: Sebastian Quintero --- nextmv/cloud/application.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nextmv/cloud/application.py b/nextmv/cloud/application.py index bce891b..4256cc6 100644 --- a/nextmv/cloud/application.py +++ b/nextmv/cloud/application.py @@ -724,8 +724,11 @@ def _run_result( return result download_url = DownloadURL.from_dict(response.json()["output"]) - download_response = requests.get(download_url.url) - download_response.raise_for_status() + download_response = self.client.request( + method="GET", + endpoint=download_url.url, + headers={"Content-Type": "application/json"}, + ) result.output = download_response.json() return result From 90a93b58d169b39112a356b806a8dd734609a12b Mon Sep 17 00:00:00 2001 From: Marius Merschformann Date: Fri, 16 Feb 2024 17:36:38 +0100 Subject: [PATCH 3/3] Remove unused import, move off deprecated ruff select setting --- nextmv/cloud/application.py | 2 -- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nextmv/cloud/application.py b/nextmv/cloud/application.py index 4256cc6..108d309 100644 --- a/nextmv/cloud/application.py +++ b/nextmv/cloud/application.py @@ -5,8 +5,6 @@ from datetime import datetime from typing import Any -import requests - from nextmv.base_model import BaseModel from nextmv.cloud.acceptance_test import AcceptanceTest, Metric from nextmv.cloud.batch_experiment import BatchExperiment, BatchExperimentMetadata, BatchExperimentRun diff --git a/pyproject.toml b/pyproject.toml index 320e244..1cbea08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ Repository = "https://github.com/nextmv-io/nextmv-py" [tool.ruff] target-version = "py312" -select = [ +lint.select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes