datachain 0.21.0__py3-none-any.whl → 0.21.1__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.

Potentially problematic release.


This version of datachain might be problematic. Click here for more details.

datachain/cli/__init__.py CHANGED
@@ -100,8 +100,10 @@ def handle_command(args, catalog, client_config) -> int:
100
100
 
101
101
  handler = command_handlers.get(args.command)
102
102
  if handler:
103
- handler()
104
- return 0
103
+ return_code = handler()
104
+ if return_code is None:
105
+ return 0
106
+ return return_code
105
107
  print(f"invalid command: {args.command}", file=sys.stderr)
106
108
  return 1
107
109
 
datachain/studio.py CHANGED
@@ -248,14 +248,17 @@ def save_config(hostname, token, level=ConfigLevel.GLOBAL):
248
248
  def show_logs_from_client(client, job_id):
249
249
  # Sync usage
250
250
  async def _run():
251
+ latest_status = None
251
252
  async for message in client.tail_job_logs(job_id):
252
253
  if "logs" in message:
253
254
  for log in message["logs"]:
254
255
  print(log["message"], end="")
255
256
  elif "job" in message:
256
- print(f"\n>>>> Job is now in {message['job']['status']} status.")
257
+ latest_status = message["job"]["status"]
258
+ print(f"\n>>>> Job is now in {latest_status} status.")
259
+ return latest_status
257
260
 
258
- asyncio.run(_run())
261
+ latest_status = asyncio.run(_run())
259
262
 
260
263
  response = client.dataset_job_versions(job_id)
261
264
  if not response.ok:
@@ -270,6 +273,12 @@ def show_logs_from_client(client, job_id):
270
273
  else:
271
274
  print("\n\nNo dataset versions created during the job.")
272
275
 
276
+ exit_code_by_status = {
277
+ "FAILED": 1,
278
+ "CANCELLED": 2,
279
+ }
280
+ return exit_code_by_status.get(latest_status.upper(), 0) if latest_status else 0
281
+
273
282
 
274
283
  def create_job(
275
284
  query_file: str,
@@ -326,7 +335,7 @@ def create_job(
326
335
  print("Open the job in Studio at", response.data.get("job", {}).get("url"))
327
336
  print("=" * 40)
328
337
 
329
- show_logs_from_client(client, job_id)
338
+ return show_logs_from_client(client, job_id)
330
339
 
331
340
 
332
341
  def upload_files(client: StudioClient, files: list[str]) -> list[str]:
@@ -396,7 +405,7 @@ def show_job_logs(job_id: str, team_name: Optional[str]):
396
405
  )
397
406
 
398
407
  client = StudioClient(team=team_name)
399
- show_logs_from_client(client, job_id)
408
+ return show_logs_from_client(client, job_id)
400
409
 
401
410
 
402
411
  def list_clusters(team_name: Optional[str]):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datachain
3
- Version: 0.21.0
3
+ Version: 0.21.1
4
4
  Summary: Wrangle unstructured AI data at scale
5
5
  Author-email: Dmitry Petrov <support@dvc.org>
6
6
  License-Expression: Apache-2.0
@@ -15,14 +15,14 @@ datachain/progress.py,sha256=lRzxoYP4Qv2XBwD78sOkmYRzHFpZ2ExVNJF8wAeICtY,770
15
15
  datachain/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  datachain/script_meta.py,sha256=V-LaFOZG84pD0Zc0NvejYdzwDgzITv6yHvAHggDCnuY,4978
17
17
  datachain/semver.py,sha256=UB8GHPBtAP3UJGeiuJoInD7SK-DnB93_Xd1qy_CQ9cU,2074
18
- datachain/studio.py,sha256=i_i669se7xSjVIChl0aCGyw_DqANUWvTyKegm9QWBrE,12398
18
+ datachain/studio.py,sha256=u74vy3iymPFSXU9ePi7KNOSwv-vQYUUS7BuEoC8cLfs,12697
19
19
  datachain/telemetry.py,sha256=0A4IOPPp9VlP5pyW9eBfaTK3YhHGzHl7dQudQjUAx9A,994
20
20
  datachain/utils.py,sha256=DNqOi-Ydb7InyWvD9m7_yailxz6-YGpZzh00biQaHNo,15305
21
21
  datachain/catalog/__init__.py,sha256=cMZzSz3VoUi-6qXSVaHYN-agxQuAcz2XSqnEPZ55crE,353
22
22
  datachain/catalog/catalog.py,sha256=J1MKOuoMSl5B0_XYGF5EjDPm7KCvOvllz8PXxt316Og,59352
23
23
  datachain/catalog/datasource.py,sha256=IkGMh0Ttg6Q-9DWfU_H05WUnZepbGa28HYleECi6K7I,1353
24
24
  datachain/catalog/loader.py,sha256=UXjYD6BNRoupPvkiz3-b04jepXhtLHCA4gzKFnXxOtQ,5987
25
- datachain/cli/__init__.py,sha256=eKCyqT05OMESHXCC93iQdqzusBdk1ptqZbBeaEghkgo,8344
25
+ datachain/cli/__init__.py,sha256=AQqMMC4zwBi06XfyDg8mIkCRjL7OtyH7W-9Lq6GyQnc,8421
26
26
  datachain/cli/utils.py,sha256=wrLnAh7Wx8O_ojZE8AE4Lxn5WoxHbOj7as8NWlLAA74,3036
27
27
  datachain/cli/commands/__init__.py,sha256=zp3bYIioO60x_X04A4-IpZqSYVnpwOa1AdERQaRlIhI,493
28
28
  datachain/cli/commands/datasets.py,sha256=77QBkn_Enok0vzkHE0rqCbM9YQuXK1oQNdfCCSKoFKE,5793
@@ -153,9 +153,9 @@ datachain/sql/sqlite/vector.py,sha256=ncW4eu2FlJhrP_CIpsvtkUabZlQdl2D5Lgwy_cbfqR
153
153
  datachain/toolkit/__init__.py,sha256=eQ58Q5Yf_Fgv1ZG0IO5dpB4jmP90rk8YxUWmPc1M2Bo,68
154
154
  datachain/toolkit/split.py,sha256=ktGWzY4kyzjWyR86dhvzw-Zhl0lVk_LOX3NciTac6qo,2914
155
155
  datachain/torch/__init__.py,sha256=gIS74PoEPy4TB3X6vx9nLO0Y3sLJzsA8ckn8pRWihJM,579
156
- datachain-0.21.0.dist-info/licenses/LICENSE,sha256=8DnqK5yoPI_E50bEg_zsHKZHY2HqPy4rYN338BHQaRA,11344
157
- datachain-0.21.0.dist-info/METADATA,sha256=BHetpdKogCt4xUdJ2nTjzpPfkEOWK69ILKOkcfy8xR8,13281
158
- datachain-0.21.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
159
- datachain-0.21.0.dist-info/entry_points.txt,sha256=0GMJS6B_KWq0m3VT98vQI2YZodAMkn4uReZ_okga9R4,49
160
- datachain-0.21.0.dist-info/top_level.txt,sha256=lZPpdU_2jJABLNIg2kvEOBi8PtsYikbN1OdMLHk8bTg,10
161
- datachain-0.21.0.dist-info/RECORD,,
156
+ datachain-0.21.1.dist-info/licenses/LICENSE,sha256=8DnqK5yoPI_E50bEg_zsHKZHY2HqPy4rYN338BHQaRA,11344
157
+ datachain-0.21.1.dist-info/METADATA,sha256=AgSKtpuTkewsQ0JUUIt_mI3BdzEksWWfE2BpWQuf4HE,13281
158
+ datachain-0.21.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
159
+ datachain-0.21.1.dist-info/entry_points.txt,sha256=0GMJS6B_KWq0m3VT98vQI2YZodAMkn4uReZ_okga9R4,49
160
+ datachain-0.21.1.dist-info/top_level.txt,sha256=lZPpdU_2jJABLNIg2kvEOBi8PtsYikbN1OdMLHk8bTg,10
161
+ datachain-0.21.1.dist-info/RECORD,,