futurehouse-client 0.3.18.dev184__py3-none-any.whl → 0.3.18.dev186__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- futurehouse_client/clients/rest_client.py +32 -6
- {futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/METADATA +1 -1
- {futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/RECORD +5 -5
- {futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/WHEEL +0 -0
- {futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/top_level.txt +0 -0
@@ -358,12 +358,12 @@ class RestClient:
|
|
358
358
|
if not files:
|
359
359
|
raise TaskFetchError(f"No files found in {path}")
|
360
360
|
|
361
|
+
@refresh_token_on_auth_error()
|
361
362
|
@retry(
|
362
363
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
363
364
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
364
365
|
retry=retry_if_connection_error,
|
365
366
|
)
|
366
|
-
@refresh_token_on_auth_error()
|
367
367
|
def get_task(
|
368
368
|
self, task_id: str | None = None, history: bool = False, verbose: bool = False
|
369
369
|
) -> "TaskResponse":
|
@@ -385,6 +385,7 @@ class RestClient:
|
|
385
385
|
),
|
386
386
|
self.client.stream("GET", url, params={"history": history}) as response,
|
387
387
|
):
|
388
|
+
response.raise_for_status()
|
388
389
|
json_data = "".join(response.iter_text(chunk_size=1024))
|
389
390
|
data = json.loads(json_data)
|
390
391
|
if "id" not in data:
|
@@ -411,12 +412,12 @@ class RestClient:
|
|
411
412
|
except Exception as e:
|
412
413
|
raise TaskFetchError(f"Error getting task: {e!s}") from e
|
413
414
|
|
415
|
+
@refresh_token_on_auth_error()
|
414
416
|
@retry(
|
415
417
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
416
418
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
417
419
|
retry=retry_if_connection_error,
|
418
420
|
)
|
419
|
-
@refresh_token_on_auth_error()
|
420
421
|
async def aget_task(
|
421
422
|
self, task_id: str | None = None, history: bool = False, verbose: bool = False
|
422
423
|
) -> "TaskResponse":
|
@@ -504,12 +505,12 @@ class RestClient:
|
|
504
505
|
raise TaskFetchError(f"Error creating task: {e!s}") from e
|
505
506
|
return trajectory_id
|
506
507
|
|
508
|
+
@refresh_token_on_auth_error()
|
507
509
|
@retry(
|
508
510
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
509
511
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
510
512
|
retry=retry_if_connection_error,
|
511
513
|
)
|
512
|
-
@refresh_token_on_auth_error()
|
513
514
|
async def acreate_task(self, task_data: TaskRequest | dict[str, Any]):
|
514
515
|
"""Create a new futurehouse task."""
|
515
516
|
if isinstance(task_data, dict):
|
@@ -682,12 +683,12 @@ class RestClient:
|
|
682
683
|
for task_id in trajectory_ids
|
683
684
|
]
|
684
685
|
|
686
|
+
@refresh_token_on_auth_error()
|
685
687
|
@retry(
|
686
688
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
687
689
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
688
690
|
retry=retry_if_connection_error,
|
689
691
|
)
|
690
|
-
@refresh_token_on_auth_error()
|
691
692
|
def get_build_status(self, build_id: UUID | None = None) -> dict[str, Any]:
|
692
693
|
"""Get the status of a build."""
|
693
694
|
try:
|
@@ -706,12 +707,12 @@ class RestClient:
|
|
706
707
|
return response.json()
|
707
708
|
|
708
709
|
# TODO: Refactor later so we don't have to ignore PLR0915
|
710
|
+
@refresh_token_on_auth_error()
|
709
711
|
@retry(
|
710
712
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
711
713
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
712
714
|
retry=retry_if_connection_error,
|
713
715
|
)
|
714
|
-
@refresh_token_on_auth_error()
|
715
716
|
def create_job(self, config: JobDeploymentConfig) -> dict[str, Any]: # noqa: PLR0915
|
716
717
|
"""Creates a futurehouse job deployment from the environment and environment files.
|
717
718
|
|
@@ -973,6 +974,7 @@ class RestClient:
|
|
973
974
|
except Exception as e:
|
974
975
|
raise FileUploadError(f"Error uploading directory {dir_path}: {e}") from e
|
975
976
|
|
977
|
+
@refresh_token_on_auth_error()
|
976
978
|
def _upload_single_file(
|
977
979
|
self,
|
978
980
|
job_name: str,
|
@@ -1046,11 +1048,20 @@ class RestClient:
|
|
1046
1048
|
)
|
1047
1049
|
|
1048
1050
|
logger.info(f"Successfully uploaded {file_name}")
|
1049
|
-
|
1051
|
+
except HTTPStatusError as e:
|
1052
|
+
if e.response.status_code in AUTH_ERRORS_TO_RETRY_ON:
|
1053
|
+
raise AuthError(
|
1054
|
+
e.response.status_code,
|
1055
|
+
f"Authentication failed: {e}",
|
1056
|
+
request=e.request,
|
1057
|
+
response=e.response,
|
1058
|
+
) from e
|
1059
|
+
raise
|
1050
1060
|
except Exception as e:
|
1051
1061
|
logger.exception(f"Error uploading file {file_path}")
|
1052
1062
|
raise FileUploadError(f"Error uploading file {file_path}: {e}") from e
|
1053
1063
|
|
1064
|
+
@refresh_token_on_auth_error()
|
1054
1065
|
@retry(
|
1055
1066
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1056
1067
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
@@ -1087,6 +1098,13 @@ class RestClient:
|
|
1087
1098
|
response.raise_for_status()
|
1088
1099
|
return response.json()
|
1089
1100
|
except HTTPStatusError as e:
|
1101
|
+
if e.response.status_code in AUTH_ERRORS_TO_RETRY_ON:
|
1102
|
+
raise AuthError(
|
1103
|
+
e.response.status_code,
|
1104
|
+
f"Authentication failed: {e}",
|
1105
|
+
request=e.request,
|
1106
|
+
response=e.response,
|
1107
|
+
) from e
|
1090
1108
|
logger.exception(
|
1091
1109
|
f"Error listing files for job {job_name}, trajectory {trajectory_id}, upload_id {upload_id}: {e.response.text}"
|
1092
1110
|
)
|
@@ -1099,6 +1117,7 @@ class RestClient:
|
|
1099
1117
|
)
|
1100
1118
|
raise RestClientError(f"Error listing files: {e!s}") from e
|
1101
1119
|
|
1120
|
+
@refresh_token_on_auth_error()
|
1102
1121
|
@retry(
|
1103
1122
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1104
1123
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
@@ -1146,6 +1165,13 @@ class RestClient:
|
|
1146
1165
|
|
1147
1166
|
logger.info(f"File {file_path} downloaded to {destination_path}")
|
1148
1167
|
except HTTPStatusError as e:
|
1168
|
+
if e.response.status_code in AUTH_ERRORS_TO_RETRY_ON:
|
1169
|
+
raise AuthError(
|
1170
|
+
e.response.status_code,
|
1171
|
+
f"Authentication failed: {e}",
|
1172
|
+
request=e.request,
|
1173
|
+
response=e.response,
|
1174
|
+
) from e
|
1149
1175
|
logger.exception(
|
1150
1176
|
f"Error downloading file {file_path} for job {job_name}, trajectory_id {trajectory_id}: {e.response.text}"
|
1151
1177
|
)
|
{futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.3.18.
|
3
|
+
Version: 0.3.18.dev186
|
4
4
|
Summary: A client for interacting with endpoints of the FutureHouse service.
|
5
5
|
Author-email: FutureHouse technical staff <hello@futurehouse.org>
|
6
6
|
Classifier: Operating System :: OS Independent
|
{futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/RECORD
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
futurehouse_client/__init__.py,sha256=ddxO7JE97c6bt7LjNglZZ2Ql8bYCGI9laSFeh9MP6VU,344
|
2
2
|
futurehouse_client/clients/__init__.py,sha256=tFWqwIAY5PvwfOVsCje4imjTpf6xXNRMh_UHIKVI1_0,320
|
3
3
|
futurehouse_client/clients/job_client.py,sha256=uNkqQbeZw7wbA0qDWcIOwOykrosza-jev58paJZ_mbA,11150
|
4
|
-
futurehouse_client/clients/rest_client.py,sha256=
|
4
|
+
futurehouse_client/clients/rest_client.py,sha256=W9ASP1ZKYS7UL5J9b-Km77YXEiDQ9hCf4X_9PqaZZZc,47914
|
5
5
|
futurehouse_client/models/__init__.py,sha256=5x-f9AoM1hGzJBEHcHAXSt7tPeImST5oZLuMdwp0mXc,554
|
6
6
|
futurehouse_client/models/app.py,sha256=w_1e4F0IiC-BKeOLqYkABYo4U-Nka1S-F64S_eHB2KM,26421
|
7
7
|
futurehouse_client/models/client.py,sha256=n4HD0KStKLm6Ek9nL9ylP-bkK10yzAaD1uIDF83Qp_A,1828
|
@@ -11,7 +11,7 @@ futurehouse_client/utils/auth.py,sha256=Lq9mjSGc7iuRP6fmLICCS6KjzLHN6-tJUuhYp0XX
|
|
11
11
|
futurehouse_client/utils/general.py,sha256=A_rtTiYW30ELGEZlWCIArO7q1nEmqi8hUlmBRYkMQ_c,767
|
12
12
|
futurehouse_client/utils/module_utils.py,sha256=aFyd-X-pDARXz9GWpn8SSViUVYdSbuy9vSkrzcVIaGI,4955
|
13
13
|
futurehouse_client/utils/monitoring.py,sha256=UjRlufe67kI3VxRHOd5fLtJmlCbVA2Wqwpd4uZhXkQM,8728
|
14
|
-
futurehouse_client-0.3.18.
|
15
|
-
futurehouse_client-0.3.18.
|
16
|
-
futurehouse_client-0.3.18.
|
17
|
-
futurehouse_client-0.3.18.
|
14
|
+
futurehouse_client-0.3.18.dev186.dist-info/METADATA,sha256=PvjehEQZu2ihl7kG1uDvWJVUxyYbV7J-VmAe42Ml3zo,12767
|
15
|
+
futurehouse_client-0.3.18.dev186.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
16
|
+
futurehouse_client-0.3.18.dev186.dist-info/top_level.txt,sha256=TRuLUCt_qBnggdFHCX4O_BoCu1j2X43lKfIZC-ElwWY,19
|
17
|
+
futurehouse_client-0.3.18.dev186.dist-info/RECORD,,
|
{futurehouse_client-0.3.18.dev184.dist-info → futurehouse_client-0.3.18.dev186.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|