folio-data-import 0.2.8rc3__tar.gz → 0.2.8rc5__tar.gz
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.
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/PKG-INFO +1 -1
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/pyproject.toml +2 -1
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/MARCDataImport.py +24 -15
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/LICENSE +0 -0
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/README.md +0 -0
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/UserImport.py +0 -0
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/__init__.py +0 -0
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/__main__.py +0 -0
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/marc_preprocessors/__init__.py +0 -0
- {folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/marc_preprocessors/_preprocessors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "folio_data_import"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.8rc5"
|
|
4
4
|
description = "A python module to interact with the data importing capabilities of the open-source FOLIO ILS"
|
|
5
5
|
authors = ["Brooks Travis <brooks.travis@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -33,6 +33,7 @@ flake8-docstrings = "^1.7.0"
|
|
|
33
33
|
pytest = "^8.3.2"
|
|
34
34
|
flake8 = "^7.1.1"
|
|
35
35
|
black = "^24.8.0"
|
|
36
|
+
ipykernel = "^6.29.5"
|
|
36
37
|
|
|
37
38
|
[build-system]
|
|
38
39
|
requires = ["poetry-core"]
|
{folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/MARCDataImport.py
RENAMED
|
@@ -165,7 +165,7 @@ class MARCImportJob:
|
|
|
165
165
|
"=PREPARING_FOR_PREVIEW&uiStatusAny=READY_FOR_PREVIEW&uiStatusAny=RUNNING&limit=50"
|
|
166
166
|
)
|
|
167
167
|
self.current_retry_timeout = None
|
|
168
|
-
except httpx.ConnectTimeout:
|
|
168
|
+
except (httpx.ConnectTimeout, httpx.ReadTimeout):
|
|
169
169
|
sleep(.25)
|
|
170
170
|
with httpx.Client(
|
|
171
171
|
timeout=self.current_retry_timeout,
|
|
@@ -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(
|
|
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
|
-
|
|
295
|
-
self.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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
|
-
|
|
307
|
-
|
|
308
|
-
self.
|
|
309
|
-
self.
|
|
310
|
-
|
|
311
|
-
|
|
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:
|
|
@@ -496,7 +505,7 @@ class MARCImportJob:
|
|
|
496
505
|
f"/metadata-provider/jobSummary/{self.job_id}"
|
|
497
506
|
)
|
|
498
507
|
self.current_retry_timeout = None
|
|
499
|
-
except httpx.ReadTimeout:
|
|
508
|
+
except (httpx.ConnectTimeout, httpx.ReadTimeout):
|
|
500
509
|
sleep(.25)
|
|
501
510
|
with httpx.Client(
|
|
502
511
|
timeout=self.current_retry_timeout,
|
|
File without changes
|
|
File without changes
|
{folio_data_import-0.2.8rc3 → folio_data_import-0.2.8rc5}/src/folio_data_import/UserImport.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|