folio-data-import 0.2.8rc6__py3-none-any.whl → 0.2.8rc7__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.
- folio_data_import/MARCDataImport.py +41 -31
- {folio_data_import-0.2.8rc6.dist-info → folio_data_import-0.2.8rc7.dist-info}/METADATA +1 -1
- {folio_data_import-0.2.8rc6.dist-info → folio_data_import-0.2.8rc7.dist-info}/RECORD +6 -6
- {folio_data_import-0.2.8rc6.dist-info → folio_data_import-0.2.8rc7.dist-info}/LICENSE +0 -0
- {folio_data_import-0.2.8rc6.dist-info → folio_data_import-0.2.8rc7.dist-info}/WHEEL +0 -0
- {folio_data_import-0.2.8rc6.dist-info → folio_data_import-0.2.8rc7.dist-info}/entry_points.txt +0 -0
|
@@ -21,6 +21,7 @@ import pymarc
|
|
|
21
21
|
import tabulate
|
|
22
22
|
from humps import decamelize
|
|
23
23
|
from tqdm import tqdm
|
|
24
|
+
from zmq import has
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
try:
|
|
@@ -459,34 +460,36 @@ class MARCImportJob:
|
|
|
459
460
|
await self.get_job_status()
|
|
460
461
|
sleep(1)
|
|
461
462
|
if self.finished:
|
|
462
|
-
job_summary
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
463
|
+
if job_summary := await self.get_job_summary():
|
|
464
|
+
job_summary.pop("jobExecutionId")
|
|
465
|
+
job_summary.pop("totalErrors")
|
|
466
|
+
columns = ["Summary"] + list(job_summary.keys())
|
|
467
|
+
rows = set()
|
|
468
|
+
for key in columns[1:]:
|
|
469
|
+
rows.update(job_summary[key].keys())
|
|
470
|
+
|
|
471
|
+
table_data = []
|
|
472
|
+
for row in rows:
|
|
473
|
+
metric_name = decamelize(row).split("_")[1]
|
|
474
|
+
table_row = [metric_name]
|
|
475
|
+
for col in columns[1:]:
|
|
476
|
+
table_row.append(job_summary[col].get(row, "N/A"))
|
|
477
|
+
table_data.append(table_row)
|
|
478
|
+
table_data.sort(key=lambda x: REPORT_SUMMARY_ORDERING.get(x[0], 99))
|
|
479
|
+
columns = columns[:1] + [
|
|
480
|
+
" ".join(decamelize(x).split("_")[:-1]) for x in columns[1:]
|
|
481
|
+
]
|
|
482
|
+
print(
|
|
483
|
+
f"Results for {'file' if len(self.current_file) == 1 else 'files'}: "
|
|
484
|
+
f"{', '.join([os.path.basename(x.name) for x in self.current_file])}"
|
|
485
|
+
)
|
|
486
|
+
print(
|
|
487
|
+
tabulate.tabulate(
|
|
488
|
+
table_data, headers=columns, tablefmt="fancy_grid"
|
|
489
|
+
),
|
|
490
|
+
)
|
|
491
|
+
else:
|
|
492
|
+
print(f"No job summary available for job {self.job_id}.")
|
|
490
493
|
self.last_current = 0
|
|
491
494
|
self.finished = False
|
|
492
495
|
|
|
@@ -501,9 +504,14 @@ class MARCImportJob:
|
|
|
501
504
|
self.current_retry_timeout = (
|
|
502
505
|
self.current_retry_timeout * RETRY_TIMEOUT_RETRY_FACTOR
|
|
503
506
|
) if self.current_retry_timeout else RETRY_TIMEOUT_START
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
+
with httpx.Client(
|
|
508
|
+
timeout=self.current_retry_timeout,
|
|
509
|
+
verify=self.folio_client.ssl_verify
|
|
510
|
+
) as temp_client:
|
|
511
|
+
self.folio_client.httpx_client = temp_client
|
|
512
|
+
job_summary = self.folio_client.folio_get(
|
|
513
|
+
f"/metadata-provider/jobSummary/{self.job_id}"
|
|
514
|
+
)
|
|
507
515
|
self.current_retry_timeout = None
|
|
508
516
|
except (httpx.ConnectTimeout, httpx.ReadTimeout, httpx.HTTPStatusError) as e:
|
|
509
517
|
if not hasattr(e, "response") or e.response.status_code == 502:
|
|
@@ -514,6 +522,8 @@ class MARCImportJob:
|
|
|
514
522
|
) as temp_client:
|
|
515
523
|
self.folio_client.httpx_client = temp_client
|
|
516
524
|
return await self.get_job_status()
|
|
525
|
+
elif hasattr(e, "response") and e.response.status_code == 504:
|
|
526
|
+
job_summary = {}
|
|
517
527
|
else:
|
|
518
528
|
raise e
|
|
519
529
|
return job_summary
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
folio_data_import/MARCDataImport.py,sha256=
|
|
1
|
+
folio_data_import/MARCDataImport.py,sha256=b4Qdja0S1_mrrxjVkVsEBatm0Kr2ZfI3b5ZRkzD0kRA,24845
|
|
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=CMG4Xq3vR84xmNFUJfRmnU0A5lchAfK33xDzeiC2AWk,2787
|
|
7
|
-
folio_data_import-0.2.
|
|
8
|
-
folio_data_import-0.2.
|
|
9
|
-
folio_data_import-0.2.
|
|
10
|
-
folio_data_import-0.2.
|
|
11
|
-
folio_data_import-0.2.
|
|
7
|
+
folio_data_import-0.2.8rc7.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
|
|
8
|
+
folio_data_import-0.2.8rc7.dist-info/METADATA,sha256=NtI0ue7pc177DJ7KtCgYekGYbeeDs-PC_-HI0AtZmCI,6115
|
|
9
|
+
folio_data_import-0.2.8rc7.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
10
|
+
folio_data_import-0.2.8rc7.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
|
|
11
|
+
folio_data_import-0.2.8rc7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{folio_data_import-0.2.8rc6.dist-info → folio_data_import-0.2.8rc7.dist-info}/entry_points.txt
RENAMED
|
File without changes
|