kleinkram 0.25.8.dev20241004161727__py3-none-any.whl → 0.25.10.dev20241007123024__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.
kleinkram/helper.py CHANGED
@@ -7,7 +7,8 @@ from functools import partial
7
7
 
8
8
  import typer
9
9
  from botocore.config import Config
10
- from typing_extensions import Dict
10
+ from botocore.utils import calculate_md5
11
+ from typing_extensions import Dict, List
11
12
  import boto3
12
13
 
13
14
  import tqdm
@@ -127,18 +128,24 @@ def uploadFiles(files: Dict[str, str], credentials: Dict[str, str], nrThreads: i
127
128
  _queue.put(file)
128
129
  threads = []
129
130
  transferCallback = TransferCallback()
131
+ failed_uploads = []
132
+
130
133
 
131
134
  for i in range(nrThreads):
132
135
  thread = threading.Thread(
133
- target=uploadFile, args=(_queue, s3, transferCallback)
136
+ target=uploadFile, args=(_queue, s3, transferCallback, failed_uploads)
134
137
  )
135
138
  thread.start()
136
139
  threads.append(thread)
137
140
  for thread in threads:
138
141
  thread.join()
142
+ if(len(failed_uploads) > 0):
143
+ print("Failed to upload the following files:")
144
+ for file in failed_uploads:
145
+ print(file)
139
146
 
140
147
 
141
- def uploadFile(_queue: queue.Queue, s3: BaseClient, transferCallback: TransferCallback):
148
+ def uploadFile(_queue: queue.Queue, s3: BaseClient, transferCallback: TransferCallback, failed_uploads: List[str]):
142
149
  while True:
143
150
  try:
144
151
  filename, _file = _queue.get(timeout=3)
@@ -150,21 +157,26 @@ def uploadFile(_queue: queue.Queue, s3: BaseClient, transferCallback: TransferCa
150
157
  multipart_chunksize=10 * 1024 * 1024, max_concurrency=5
151
158
  )
152
159
  with open(filepath, "rb") as f:
153
- size = os.path.getsize(filepath)
154
- transferCallback.add_file(filename, size)
160
+ md5_checksum = calculate_md5(f)
161
+ file_size = os.path.getsize(filepath)
162
+ transferCallback.add_file(filename, file_size)
155
163
  callback_function = create_transfer_callback(transferCallback, filename)
156
164
  s3.Bucket(bucket).upload_file(
157
- filepath, target_location, Config=config, Callback=callback_function
165
+ filepath,
166
+ target_location,
167
+ Config=config,
168
+ Callback=callback_function,
158
169
  )
159
170
 
160
171
  client = AuthenticatedClient()
161
- res = client.post("/queue/confirmUpload", json={"uuid": queueUUID})
172
+ res = client.post("/queue/confirmUpload", json={"uuid": queueUUID, "md5": md5_checksum})
162
173
  res.raise_for_status()
163
174
  _queue.task_done()
164
175
  except queue.Empty:
165
176
  break
166
177
  except Exception as e:
167
178
  print(f"Error uploading {filename}: {e}")
179
+ failed_uploads.append(filepath)
168
180
  _queue.task_done()
169
181
 
170
182
 
@@ -1,4 +1,6 @@
1
1
  import os
2
+
3
+ from botocore.utils import calculate_md5
2
4
  from typing_extensions import Annotated, Optional, List
3
5
 
4
6
  import httpx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kleinkram
3
- Version: 0.25.8.dev20241004161727
3
+ Version: 0.25.10.dev20241007123024
4
4
  Summary: A CLI for the ETH project kleinkram
5
5
  Project-URL: Homepage, https://github.com/leggedrobotics/kleinkram
6
6
  Project-URL: Issues, https://github.com/leggedrobotics/kleinkram/issues
@@ -2,19 +2,19 @@ kleinkram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  kleinkram/api_client.py,sha256=1GPsM-XFbPYEKP7RfWmzMTwxRqnVh4wtHVuW25KT8kA,2264
3
3
  kleinkram/consts.py,sha256=pm_6OuQcO-tYcRhwauTtyRRsuYY0y0yb6EGuIl49LnI,50
4
4
  kleinkram/error_handling.py,sha256=Nm3tUtc4blQylJLNChSLgkDLFDHg3Xza0CghRrd_SYE,4015
5
- kleinkram/helper.py,sha256=BQawKoKLIwtAtVIZ7MjxH6Azqi7wHP4ja_gsrqyYAWU,7849
5
+ kleinkram/helper.py,sha256=YlL955tLhD_XonN8dpnpYDKkPO9WUrkEyLrt3JQip-o,8296
6
6
  kleinkram/main.py,sha256=9u_msMlPhphfaL92GNrm-cRUeSHxc_mOFPeXLDzv-ok,9642
7
7
  kleinkram/auth/auth.py,sha256=w3-TsxWxURzLQ3_p43zgV4Rlh4dVL_WqI6HG2aes-b4,4991
8
8
  kleinkram/endpoint/endpoint.py,sha256=uez5UrAnP7L5rVHUysA9tFkN3dB3dG1Ojt9g3w-UWuQ,1441
9
9
  kleinkram/file/file.py,sha256=LaqIFYZ2HL5-tCqEXqQJ-ptXU8Eyg0T4Hy5W0NATEXg,3395
10
- kleinkram/mission/mission.py,sha256=UuKMZqU3gbdxq6J4WJ_RSo90slhIqexhDotmDyGY-6E,8634
10
+ kleinkram/mission/mission.py,sha256=ByztTOQYW2exvXRravebI_UkzU_iSp-PQiH_wR4Ly6Y,8676
11
11
  kleinkram/project/project.py,sha256=yDygz9JJ4Td5VsoCoCLm36HccRyd7jl65Hq05uxEGts,1602
12
12
  kleinkram/queue/queue.py,sha256=MaLBjAu8asi9BkPvbbT-5AobCcpy3ex5rxM1kHpRINA,181
13
13
  kleinkram/tag/tag.py,sha256=JSHbDPVfsvP34MuQhw__DPQk-Bah5G9BgwYsj_K_JGc,1805
14
14
  kleinkram/topic/topic.py,sha256=IaXhrIHcJ3FSIr0WC-N7u9fkz-lAvSBgQklTX67t0Yc,1641
15
15
  kleinkram/user/user.py,sha256=hDrbWeFPPnh2sswDd445SwcIFGyAbfXXWpYq1VqrK0g,1379
16
- kleinkram-0.25.8.dev20241004161727.dist-info/METADATA,sha256=2TaUVnqPE5iL0WUM1uDshVOwwxCCkzj9pj6bMBD4_Zc,845
17
- kleinkram-0.25.8.dev20241004161727.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
- kleinkram-0.25.8.dev20241004161727.dist-info/entry_points.txt,sha256=RHXtRzcreVHImatgjhQwZQ6GdJThElYjHEWcR1BPXUI,45
19
- kleinkram-0.25.8.dev20241004161727.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
20
- kleinkram-0.25.8.dev20241004161727.dist-info/RECORD,,
16
+ kleinkram-0.25.10.dev20241007123024.dist-info/METADATA,sha256=6NwF32wRNX5BQuq95zRr01UB1xHD9FNU64S9Ytr2_Ys,846
17
+ kleinkram-0.25.10.dev20241007123024.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
+ kleinkram-0.25.10.dev20241007123024.dist-info/entry_points.txt,sha256=RHXtRzcreVHImatgjhQwZQ6GdJThElYjHEWcR1BPXUI,45
19
+ kleinkram-0.25.10.dev20241007123024.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
20
+ kleinkram-0.25.10.dev20241007123024.dist-info/RECORD,,