futurehouse-client 0.3.17.dev94__tar.gz → 0.3.18.dev25__tar.gz
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-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/PKG-INFO +1 -1
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/clients/rest_client.py +35 -13
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client.egg-info/PKG-INFO +1 -1
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/LICENSE +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/README.md +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/docs/__init__.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/docs/client_notebook.ipynb +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/__init__.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/clients/__init__.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/clients/job_client.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/models/__init__.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/models/app.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/models/client.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/models/rest.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/utils/__init__.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/utils/general.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/utils/module_utils.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/utils/monitoring.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client.egg-info/SOURCES.txt +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client.egg-info/dependency_links.txt +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client.egg-info/requires.txt +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client.egg-info/top_level.txt +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/pyproject.toml +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/setup.cfg +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/tests/test_rest.py +0 -0
- {futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.18.dev25
|
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
|
@@ -917,14 +917,14 @@ class RestClient:
|
|
917
917
|
self,
|
918
918
|
job_name: str,
|
919
919
|
file_path: str | os.PathLike,
|
920
|
-
|
920
|
+
upload_id: str | None = None,
|
921
921
|
) -> str:
|
922
922
|
"""Upload a file or directory to a futurehouse job bucket.
|
923
923
|
|
924
924
|
Args:
|
925
925
|
job_name: The name of the futurehouse job to upload to.
|
926
926
|
file_path: The local path to the file or directory to upload.
|
927
|
-
|
927
|
+
upload_id: Optional folder name to use for the upload. If not provided, a random UUID will be used.
|
928
928
|
|
929
929
|
Returns:
|
930
930
|
The upload ID used for the upload.
|
@@ -936,7 +936,7 @@ class RestClient:
|
|
936
936
|
if not file_path.exists():
|
937
937
|
raise FileNotFoundError(f"File or directory not found: {file_path}")
|
938
938
|
|
939
|
-
upload_id =
|
939
|
+
upload_id = upload_id or str(uuid.uuid4())
|
940
940
|
|
941
941
|
if file_path.is_dir():
|
942
942
|
# Process directory recursively
|
@@ -1056,12 +1056,18 @@ class RestClient:
|
|
1056
1056
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
1057
1057
|
retry=retry_if_connection_error,
|
1058
1058
|
)
|
1059
|
-
def list_files(
|
1059
|
+
def list_files(
|
1060
|
+
self,
|
1061
|
+
job_name: str,
|
1062
|
+
trajectory_id: str | None = None,
|
1063
|
+
upload_id: str | None = None,
|
1064
|
+
) -> dict[str, list[str]]:
|
1060
1065
|
"""List files and directories in a GCS location for a given job_name and upload_id.
|
1061
1066
|
|
1062
1067
|
Args:
|
1063
1068
|
job_name: The name of the futurehouse job.
|
1064
|
-
|
1069
|
+
trajectory_id: The specific trajectory id to list files from.
|
1070
|
+
upload_id: The specific upload id to list files from.
|
1065
1071
|
|
1066
1072
|
Returns:
|
1067
1073
|
A list of files in the GCS folder.
|
@@ -1069,22 +1075,27 @@ class RestClient:
|
|
1069
1075
|
Raises:
|
1070
1076
|
RestClientError: If there is an error listing the files.
|
1071
1077
|
"""
|
1078
|
+
if not bool(trajectory_id) ^ bool(upload_id):
|
1079
|
+
raise RestClientError(
|
1080
|
+
"Must at least specify one of trajectory_id or upload_id, but not both"
|
1081
|
+
)
|
1072
1082
|
try:
|
1073
1083
|
url = f"/v0.1/crows/{job_name}/list-files"
|
1074
|
-
params = {"upload_id":
|
1084
|
+
params = {"trajectory_id": trajectory_id, "upload_id": upload_id}
|
1085
|
+
params = {k: v for k, v in params.items() if v is not None}
|
1075
1086
|
response = self.client.get(url, params=params)
|
1076
1087
|
response.raise_for_status()
|
1077
1088
|
return response.json()
|
1078
1089
|
except HTTPStatusError as e:
|
1079
1090
|
logger.exception(
|
1080
|
-
f"Error listing files for job {job_name},
|
1091
|
+
f"Error listing files for job {job_name}, trajectory {trajectory_id}, upload_id {upload_id}: {e.response.text}"
|
1081
1092
|
)
|
1082
1093
|
raise RestClientError(
|
1083
1094
|
f"Error listing files: {e.response.status_code} - {e.response.text}"
|
1084
1095
|
) from e
|
1085
1096
|
except Exception as e:
|
1086
1097
|
logger.exception(
|
1087
|
-
f"Error listing files for job {job_name},
|
1098
|
+
f"Error listing files for job {job_name}, trajectory {trajectory_id}, upload_id {upload_id}"
|
1088
1099
|
)
|
1089
1100
|
raise RestClientError(f"Error listing files: {e!s}") from e
|
1090
1101
|
|
@@ -1096,7 +1107,7 @@ class RestClient:
|
|
1096
1107
|
def download_file(
|
1097
1108
|
self,
|
1098
1109
|
job_name: str,
|
1099
|
-
|
1110
|
+
trajectory_id: str,
|
1100
1111
|
file_path: str,
|
1101
1112
|
destination_path: str | os.PathLike,
|
1102
1113
|
) -> None:
|
@@ -1104,7 +1115,7 @@ class RestClient:
|
|
1104
1115
|
|
1105
1116
|
Args:
|
1106
1117
|
job_name: The name of the futurehouse job.
|
1107
|
-
|
1118
|
+
trajectory_id: The specific trajectory id the file belongs to.
|
1108
1119
|
file_path: The relative path of the file to download
|
1109
1120
|
(e.g., 'data/my_file.csv' or 'my_image.png').
|
1110
1121
|
destination_path: The local path where the file should be saved.
|
@@ -1119,7 +1130,7 @@ class RestClient:
|
|
1119
1130
|
|
1120
1131
|
try:
|
1121
1132
|
url = f"/v0.1/crows/{job_name}/download-file"
|
1122
|
-
params = {"
|
1133
|
+
params = {"trajectory_id": trajectory_id, "file_path": file_path}
|
1123
1134
|
|
1124
1135
|
with self.client.stream("GET", url, params=params) as response:
|
1125
1136
|
response.raise_for_status() # Check for HTTP errors before streaming
|
@@ -1129,7 +1140,7 @@ class RestClient:
|
|
1129
1140
|
logger.info(f"File {file_path} downloaded to {destination_path}")
|
1130
1141
|
except HTTPStatusError as e:
|
1131
1142
|
logger.exception(
|
1132
|
-
f"Error downloading file {file_path} for job {job_name},
|
1143
|
+
f"Error downloading file {file_path} for job {job_name}, trajectory_id {trajectory_id}: {e.response.text}"
|
1133
1144
|
)
|
1134
1145
|
# Clean up partially downloaded file if an error occurs
|
1135
1146
|
if destination_path.exists():
|
@@ -1137,9 +1148,20 @@ class RestClient:
|
|
1137
1148
|
raise RestClientError(
|
1138
1149
|
f"Error downloading file: {e.response.status_code} - {e.response.text}"
|
1139
1150
|
) from e
|
1151
|
+
except RemoteProtocolError as e:
|
1152
|
+
logger.error(
|
1153
|
+
f"Connection error while downloading file {file_path} for job {job_name}, trajectory_id {trajectory_id}"
|
1154
|
+
)
|
1155
|
+
# Clean up partially downloaded file
|
1156
|
+
if destination_path.exists():
|
1157
|
+
destination_path.unlink()
|
1158
|
+
|
1159
|
+
# Often RemoteProtocolError during download means the file wasn't found
|
1160
|
+
# or was empty/corrupted on the server side
|
1161
|
+
raise FileNotFoundError(f"File not found or corrupted: {file_path}") from e
|
1140
1162
|
except Exception as e:
|
1141
1163
|
logger.exception(
|
1142
|
-
f"Error downloading file {file_path} for job {job_name},
|
1164
|
+
f"Error downloading file {file_path} for job {job_name}, trajectory_id {trajectory_id}"
|
1143
1165
|
)
|
1144
1166
|
if destination_path.exists():
|
1145
1167
|
destination_path.unlink() # Clean up partial file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.18.dev25
|
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
|
File without changes
|
File without changes
|
File without changes
|
{futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/docs/client_notebook.ipynb
RENAMED
File without changes
|
{futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{futurehouse_client-0.3.17.dev94 → futurehouse_client-0.3.18.dev25}/futurehouse_client/models/app.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|