MCPcopy Index your code
hub / github.com/diffgram/diffgram / process_chunk

Method process_chunk

walrus/methods/input/upload.py:203–240  ·  view source on GitHub ↗

Not 100% sure on where the try blocks should be used in this case... or how we want to handle response errors on requests.put() side.

(self, request, input)

Source from the content-addressed store, hash-verified

201 )
202
203 def process_chunk(self, request, input):
204 """
205 Not 100% sure on where the try blocks should be used
206 in this case... or how we want to handle response errors
207 on requests.put() side.
208 """
209
210 stream = self.binary_file.stream.read()
211 content_size = len(stream)
212 logger.info(f"upload_large_api: raw_data_blob_path {input.raw_data_blob_path}")
213 logger.info(f"upload_large_api: input_type {input.type}")
214 logger.info(f"upload_large_api: media_type {input.media_type}")
215 logger.info(f"upload_large_api: input ID {input.id}")
216 try:
217 response = data_tools.transmit_chunk_of_resumable_upload(
218 stream = stream,
219 blob_path = input.raw_data_blob_path,
220 prior_created_url = input.resumable_url,
221 content_type = None,
222 content_start = self.dzchunkbyteoffset,
223 content_size = content_size,
224 total_size = self.dztotalfilesize,
225 total_parts_count = self.dztotalchunkcount,
226 chunk_index = self.dzchunkindex,
227 input = self.input,
228 )
229 self.session.add(self.input)
230 if response is False:
231 logger.error('Upload failed: Please try again, or try using API/SDK. (Raw upload error)')
232 input.status = "failed"
233 input.status_text = "Please try again, or try using API/SDK. (Raw upload error)"
234 return
235
236 except Exception as exception:
237 logger.error(f"Upload failed: {traceback.format_exc()}")
238 input.status = "failed"
239 input.status_text = "Please try again, or try using API/SDK. (Raw upload error)"
240 raise Exception # TODO REMOVE
241
242 @staticmethod
243 def upload_limits(input,

Callers 1

api_project_upload_largeFunction · 0.95

Calls 2

addMethod · 0.45

Tested by

no test coverage detected