3
3
import sys
4
4
from typing import TYPE_CHECKING , Optional
5
5
6
- from datachain .catalog .catalog import raise_remote_error
7
6
from datachain .config import Config , ConfigLevel
8
7
from datachain .dataset import QUERY_DATASET_PREFIX
9
8
from datachain .error import DataChainError
@@ -150,7 +149,7 @@ def list_datasets(team: Optional[str] = None, name: Optional[str] = None):
150
149
response = client .ls_datasets ()
151
150
152
151
if not response .ok :
153
- raise_remote_error (response .message )
152
+ raise DataChainError (response .message )
154
153
155
154
if not response .data :
156
155
return
@@ -171,7 +170,7 @@ def list_dataset_versions(team: Optional[str] = None, name: str = ""):
171
170
response = client .dataset_info (name )
172
171
173
172
if not response .ok :
174
- raise_remote_error (response .message )
173
+ raise DataChainError (response .message )
175
174
176
175
if not response .data :
177
176
return
@@ -191,7 +190,7 @@ def edit_studio_dataset(
191
190
client = StudioClient (team = team_name )
192
191
response = client .edit_dataset (name , new_name , description , labels )
193
192
if not response .ok :
194
- raise_remote_error (response .message )
193
+ raise DataChainError (response .message )
195
194
196
195
print (f"Dataset '{ name } ' updated in Studio" )
197
196
@@ -205,7 +204,7 @@ def remove_studio_dataset(
205
204
client = StudioClient (team = team_name )
206
205
response = client .rm_dataset (name , version , force )
207
206
if not response .ok :
208
- raise_remote_error (response .message )
207
+ raise DataChainError (response .message )
209
208
210
209
print (f"Dataset '{ name } ' removed from Studio" )
211
210
@@ -235,7 +234,7 @@ async def _run():
235
234
236
235
response = client .dataset_job_versions (job_id )
237
236
if not response .ok :
238
- raise_remote_error (response .message )
237
+ raise DataChainError (response .message )
239
238
240
239
response_data = response .data
241
240
if response_data :
@@ -286,7 +285,7 @@ def create_job(
286
285
requirements = requirements ,
287
286
)
288
287
if not response .ok :
289
- raise_remote_error (response .message )
288
+ raise DataChainError (response .message )
290
289
291
290
if not response .data :
292
291
raise DataChainError ("Failed to create job" )
@@ -307,7 +306,7 @@ def upload_files(client: StudioClient, files: list[str]) -> list[str]:
307
306
file_content = f .read ()
308
307
response = client .upload_file (file_content , file_name )
309
308
if not response .ok :
310
- raise_remote_error (response .message )
309
+ raise DataChainError (response .message )
311
310
312
311
if not response .data :
313
312
raise DataChainError (f"Failed to upload file { file_name } " )
@@ -328,7 +327,7 @@ def cancel_job(job_id: str, team_name: Optional[str]):
328
327
client = StudioClient (team = team_name )
329
328
response = client .cancel_job (job_id )
330
329
if not response .ok :
331
- raise_remote_error (response .message )
330
+ raise DataChainError (response .message )
332
331
333
332
print (f"Job { job_id } canceled" )
334
333
0 commit comments