folio-data-import 0.2.8rc4__py3-none-any.whl → 0.2.8rc5__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 folio-data-import might be problematic. Click here for more details.

@@ -277,7 +277,7 @@ class MARCImportJob:
277
277
  total_records = 0
278
278
  for import_file in files:
279
279
  while True:
280
- chunk = import_file.read(1024)
280
+ chunk = import_file.read(104857600)
281
281
  if not chunk:
282
282
  break
283
283
  total_records += chunk.count(b"\x1d")
@@ -291,24 +291,33 @@ class MARCImportJob:
291
291
  Args:
292
292
  batch_payload (dict): A records payload containing the current batch of MARC records.
293
293
  """
294
- post_batch = self.http_client.post(
295
- self.folio_client.okapi_url
296
- + f"/change-manager/jobExecutions/{self.job_id}/records",
297
- headers=self.folio_client.okapi_headers,
298
- json=batch_payload,
299
- )
294
+ try:
295
+ post_batch = self.http_client.post(
296
+ self.folio_client.okapi_url
297
+ + f"/change-manager/jobExecutions/{self.job_id}/records",
298
+ headers=self.folio_client.okapi_headers,
299
+ json=batch_payload,
300
+ )
301
+ except httpx.ReadTimeout:
302
+ sleep(.25)
303
+ return await self.process_record_batch(batch_payload)
300
304
  try:
301
305
  post_batch.raise_for_status()
302
306
  self.total_records_sent += len(self.record_batch)
303
307
  self.record_batch = []
304
308
  self.pbar_sent.update(len(batch_payload["initialRecords"]))
305
309
  except Exception as e:
306
- print("Error posting batch: " + str(e))
307
- for record in self.record_batch:
308
- self.failed_batches_file.write(record)
309
- self.error_records += len(self.record_batch)
310
- self.pbar_sent.total = self.pbar_sent.total - len(self.record_batch)
311
- self.record_batch = []
310
+ if hasattr(e, "response") and e.response.status_code in [500, 422]: # TODO: #26 Check for specific error code once https://folio-org.atlassian.net/browse/MODSOURMAN-1281 is resolved
311
+ self.total_records_sent += len(self.record_batch)
312
+ self.record_batch = []
313
+ self.pbar_sent.update(len(batch_payload["initialRecords"]))
314
+ else:
315
+ print("Error posting batch: " + str(e))
316
+ for record in self.record_batch:
317
+ self.failed_batches_file.write(record)
318
+ self.error_records += len(self.record_batch)
319
+ self.pbar_sent.total = self.pbar_sent.total - len(self.record_batch)
320
+ self.record_batch = []
312
321
  sleep(self.batch_delay)
313
322
 
314
323
  async def process_records(self, files, total_records) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: folio_data_import
3
- Version: 0.2.8rc4
3
+ Version: 0.2.8rc5
4
4
  Summary: A python module to interact with the data importing capabilities of the open-source FOLIO ILS
5
5
  License: MIT
6
6
  Author: Brooks Travis
@@ -1,11 +1,11 @@
1
- folio_data_import/MARCDataImport.py,sha256=DFAHFurz5ijTqRwYU1SS3vMVdAVE4OD7ukYnAsRBPyU,23492
1
+ folio_data_import/MARCDataImport.py,sha256=_HaGBq90lN-NEuDm4GWW9W026NnKujU1kjzORjICzf0,24074
2
2
  folio_data_import/UserImport.py,sha256=Y9ZjYoUP_vNJVftx_xUcbBqvC5CwWeuzlmCcSVQfzgo,40976
3
3
  folio_data_import/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  folio_data_import/__main__.py,sha256=kav_uUsnrIjGjVxQkk3exLKrc1mah9t2x3G6bGS-5I0,3710
5
5
  folio_data_import/marc_preprocessors/__init__.py,sha256=Wt-TKkMhUyZWFS-WhAmbShKQLPjXmHKPb2vL6kvkqVA,72
6
6
  folio_data_import/marc_preprocessors/_preprocessors.py,sha256=Y9t6tIFxQdzBYYniBZ3Lq05Ukk-3orAXd4YQaJuGNRA,2786
7
- folio_data_import-0.2.8rc4.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
8
- folio_data_import-0.2.8rc4.dist-info/METADATA,sha256=8-UXb7KtUNZ4dza7XzazE98L4NVnYu5x5IMRBHnNKx8,6115
9
- folio_data_import-0.2.8rc4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
10
- folio_data_import-0.2.8rc4.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
11
- folio_data_import-0.2.8rc4.dist-info/RECORD,,
7
+ folio_data_import-0.2.8rc5.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
8
+ folio_data_import-0.2.8rc5.dist-info/METADATA,sha256=cBes2BOvOrzY_3jNUohXWvChAMB-DScgYVPArV4lnvo,6115
9
+ folio_data_import-0.2.8rc5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
10
+ folio_data_import-0.2.8rc5.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
11
+ folio_data_import-0.2.8rc5.dist-info/RECORD,,