craft-ai-sdk 0.54.0rc1__py3-none-any.whl → 0.54.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.
craft_ai_sdk/__init__.py CHANGED
@@ -14,4 +14,4 @@ from .io import ( # noqa: F401
14
14
  )
15
15
 
16
16
 
17
- __version__ = "0.54.0rc1"
17
+ __version__ = "0.54.1"
@@ -148,7 +148,7 @@ def _upload_multipart_data_store_object(
148
148
  "chunk_size": sdk._MULTIPART_PART_SIZE,
149
149
  "part_number": part_idx,
150
150
  }
151
- if len < sdk._MULTIPART_PART_SIZE:
151
+ if part["lastChunk"]:
152
152
  data["size"] = (part_idx - 1) * sdk._MULTIPART_PART_SIZE + len
153
153
  multipart_part_result = sdk._post(url=f"{multipart_base_url}/part", json=data)
154
154
  resp = requests.put(
@@ -156,10 +156,12 @@ def _upload_multipart_data_store_object(
156
156
  data=chunk,
157
157
  headers=multipart_part_result["headers"],
158
158
  )
159
- part = {"number": part_idx}
159
+ partData = {"number": part_idx}
160
160
  if "ETag" in resp.headers:
161
- part["metadata"] = resp.headers["ETag"]
162
- parts.append(part)
161
+ partData["metadata"] = resp.headers["ETag"]
162
+ parts.append(partData)
163
+ if part["lastChunk"]:
164
+ break
163
165
 
164
166
  sdk._post(
165
167
  url=f"{multipart_base_url}/end",
craft_ai_sdk/io.py CHANGED
@@ -237,7 +237,7 @@ class OutputDestination:
237
237
  )
238
238
  if pipeline_output_name is None and step_output_name is None:
239
239
  raise ValueError('missing "pipeline_output_name" argument.')
240
- if pipeline_output_name is not None:
240
+ if step_output_name is not None:
241
241
  warnings.warn(
242
242
  "Providing the 'step_output_name' argument is deprecated and will "
243
243
  "be removed in a future version. Please use the 'pipeline_output_name' keyword argument instead.", # noqa: E501
craft_ai_sdk/sdk.py CHANGED
@@ -130,7 +130,7 @@ class CraftAiSdk(BaseCraftAiSdk):
130
130
  os.environ.get("CRAFT_AI__MULTIPART_PART_SIZE__B", str(38 * 256 * 1024))
131
131
  )
132
132
  _access_token_margin = timedelta(seconds=30)
133
- _version = "0.54.0rc1" # Would be better to share it somewhere
133
+ _version = "0.54.1" # Would be better to share it somewhere
134
134
 
135
135
  def __init__(
136
136
  self,
craft_ai_sdk/utils.py CHANGED
@@ -278,13 +278,25 @@ def map_container_config_step_parameter(container_config):
278
278
  def chunk_buffer(buffer: IOBase, size: int) -> Iterable[Union[BytesIO, StringIO]]:
279
279
  size_int = int(size)
280
280
  b = buffer.read(size_int)
281
+ next_data = None
281
282
  while b:
282
- yield (
283
- {"chunk": StringIO(b), "len": len(b)}
284
- if isinstance(b, str)
285
- else {"chunk": BytesIO(b), "len": len(b)}
286
- )
287
- b = buffer.read(size_int)
283
+ chunk = StringIO() if isinstance(b, str) else BytesIO()
284
+ previous_data = next_data
285
+ if previous_data:
286
+ chunk.write(next_data)
287
+ chunk.write(b)
288
+ chunk.seek(0)
289
+
290
+ next_data = buffer.read(1)
291
+
292
+ data = {
293
+ "chunk": chunk,
294
+ "len": len(b) + (len(previous_data) if previous_data else 0),
295
+ "lastChunk": len(next_data) == 0,
296
+ }
297
+ yield data
298
+ chunk.close()
299
+ b = buffer.read(size_int - 1)
288
300
 
289
301
 
290
302
  def convert_size(size_in_bytes):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: craft-ai-sdk
3
- Version: 0.54.0rc1
3
+ Version: 0.54.1
4
4
  Summary: Craft AI MLOps platform SDK
5
5
  Home-page: https://www.craft.ai/
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
- craft_ai_sdk/__init__.py,sha256=aFYFR9NYnekNpnJGtyEfoZkYbaPxEMg-fBLVUMSavz8,407
1
+ craft_ai_sdk/__init__.py,sha256=Tg8k-Ecy9qqYytNNAbLFFZ83yVZ9bRIblwS_bFnFn3I,404
2
2
  craft_ai_sdk/constants.py,sha256=5dR4JfKVz3KhBKRFSdN1nrb06kFkNiYP2mRnacsbzJA,629
3
- craft_ai_sdk/core/data_store.py,sha256=kI0nUIXfkz-9ENVEeFW70_PGhBNB_S-nntJJkKhGRoQ,8464
3
+ craft_ai_sdk/core/data_store.py,sha256=USONqCEwG_KoTv5a1fgZJmi7FIjbfo4Vi-zq82keo4E,8511
4
4
  craft_ai_sdk/core/deployments.py,sha256=fUZBHTgOWHPShMcIvNF7XEHJLAZJwJI8zLzMtdv-Dzc,31427
5
5
  craft_ai_sdk/core/endpoints.py,sha256=ggJ8IU0QVrGa7A0RBWiJY1Lo7Klfi9BbfGnovZD97FQ,4592
6
6
  craft_ai_sdk/core/environment_variables.py,sha256=wy0U7y0C7tRXOXOiWGz0vX5ajHSmOb_7J1fXlSahGpI,2045
@@ -11,13 +11,13 @@ craft_ai_sdk/core/resource_metrics.py,sha256=yaco_AZ4Wu5sxLRKsA3qt2R3-PMs2e32EGO
11
11
  craft_ai_sdk/core/steps.py,sha256=fodbswiMRzHBarBDUCcH1J3O8N8iKu9X66-wZ_Qfnb0,20375
12
12
  craft_ai_sdk/core/users.py,sha256=Qi3xg7Vzk_0MepccNIZbFzjI0bBqouqkFStTuejUY6s,509
13
13
  craft_ai_sdk/exceptions.py,sha256=IC-JfZmmmaTsbMCgirOEByRmWnatQLjKe8BErRkuwM0,1075
14
- craft_ai_sdk/io.py,sha256=y9lg5unGIwQICAPuKUdUPDAJCsxe2lbseIlmiWka2Ec,11865
15
- craft_ai_sdk/sdk.py,sha256=qajssLGx7mP6EHpj9JCQ6eRWprW0_09bB7StCSnmPSo,10071
16
- craft_ai_sdk/utils.py,sha256=w-Y4_xxTHnl9_zLBQVhDg-KB7wqJEPoTArcksf4Fu-c,11573
14
+ craft_ai_sdk/io.py,sha256=Jh9bFfXRzwCequXvJ3DKO-SIdZ7teYfzO64N940FyDY,11861
15
+ craft_ai_sdk/sdk.py,sha256=WN7zGsbAmI3-NMkCErVSvOJaSZEP44wR-GxsekfW5oY,10068
16
+ craft_ai_sdk/utils.py,sha256=syOtpNgV8XF9VoeRVnWGkjIdWv0vyS_Z8RN5QfHCfIo,11891
17
17
  craft_ai_sdk/warnings.py,sha256=xJXbUR66SVbG_ZO7rxpAZ2hkGxdUtM5JAx6JoWg77Qs,6678
18
- documentation.pdf,sha256=45J8Q29ptcM0X52UEfe_JLCNOsWH3SgU-0MhzmGkQko,334272
19
- craft_ai_sdk-0.54.0rc1.dist-info/LICENSE,sha256=_2oYRJic9lZK05LceuJ9aZZw5mPHYc1WQhJiVS-oGFU,10754
20
- craft_ai_sdk-0.54.0rc1.dist-info/METADATA,sha256=DVdVqmvB6kYeFJEp_wnLJ4lgHr59Z6RtnbduUE6272A,1617
21
- craft_ai_sdk-0.54.0rc1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
22
- craft_ai_sdk-0.54.0rc1.dist-info/entry_points.txt,sha256=eV9YD0zCAb88_wNMDV99sRxVKVC-WOQF3b1Pepaytcg,385
23
- craft_ai_sdk-0.54.0rc1.dist-info/RECORD,,
18
+ documentation.pdf,sha256=90a4ViFZAGOUzlrKiZjrt7Tx1Um__CKHwa4_m-6zT6s,333705
19
+ craft_ai_sdk-0.54.1.dist-info/LICENSE,sha256=_2oYRJic9lZK05LceuJ9aZZw5mPHYc1WQhJiVS-oGFU,10754
20
+ craft_ai_sdk-0.54.1.dist-info/METADATA,sha256=8TbrLS-64Q7xvj1o3zsFfOs08qPURECb5RbE8XdCPoA,1614
21
+ craft_ai_sdk-0.54.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
22
+ craft_ai_sdk-0.54.1.dist-info/entry_points.txt,sha256=eV9YD0zCAb88_wNMDV99sRxVKVC-WOQF3b1Pepaytcg,385
23
+ craft_ai_sdk-0.54.1.dist-info/RECORD,,
documentation.pdf CHANGED
Binary file