dcicutils 8.14.0.1b17__py3-none-any.whl → 8.14.0.1b19__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -433,15 +433,19 @@ def _load_data(portal: Portal, load: str, ini_file: str, explicit_schema_name: O
433
433
  current_item_total = 0
434
434
 
435
435
  for item in LoadGenWrapper(load_all_gen(testapp=portal.vapp, inserts=inserts_directory,
436
- docsdir=None, overwrite=True, verbose=True)):
436
+ docsdir=None, overwrite=True, verbose=True,
437
+ continue_on_exception=True)):
437
438
  loadxl_total_item_count += 1
438
439
  item = decode_bytes(item)
439
440
  match = LOADXL_RESPONSE_PATTERN.match(item)
440
441
  if not match or match.re.groups < 3:
441
442
  continue
442
443
  if (action := LOADXL_ACTION_NAME[match.group(1).upper()]) == "Error":
444
+ loadxl_total_error_count += 1
443
445
  identifying_value = match.group(2)
444
- # Example message for unresolved link:
446
+ #
447
+ # Example message for unresolved link ...
448
+ #
445
449
  # ERROR: /22813a02-906b-4b60-b2b2-4afaea24aa28 Bad response: 422 Unprocessable Entity
446
450
  # (not 200 OK or 3xx redirect for http://localhost/file_set?skip_indexing=true)b\'{"@type":
447
451
  # ["ValidationFailure", "Error"], "status": "error", "code": # 422, "title": "Unprocessable Entity",
@@ -449,21 +453,33 @@ def _load_data(portal: Portal, load: str, ini_file: str, explicit_schema_name: O
449
453
  # "description": "Unable to resolve link: /Library/a4e8f79f-4d47-4e85-9707-c343c940a315"},
450
454
  # {"location": "body", "name": "Schema: libraries.0",
451
455
  # "description": "\\\'a4e8f79f-4d47-4e85-9707-c343c940a315\\\' not found"}]}\'
456
+ #
457
+ # OR ...
458
+ #
459
+ # ERROR: /22813a02-906b-4b60-b2b2-4afaea24aa28 Bad response: 404 Not Found (not 200 OK or 3xx
460
+ # redirect for http://localhost/22813a02-906b-4b60-b2b2-4afaea24aa28)b\'{"@type": ["HTTPNotFound",
461
+ # "Error"], "status": "error", "code": 404, "title": "Not Found", "description": "The resource
462
+ # could not be found.", "detail": "debug_notfound of url http://localhost/22813a02-906b-4b60-b2b2-4afaea24aa28; # noqa
463
+ # path_info: \\\'/22813a02-906b-4b60-b2b2-4afaea24aa28\\\', context: <encoded.root.SMAHTRoot object at 0x136d41460>, # noqa
464
+ # view_name: \\\'22813a02-906b-4b60-b2b2-4afaea24aa28\\\', subpath: (), traversed: (), root:
465
+ # <encoded.root.SMAHTRoot object at 0x136d41460>, vroot: <encoded.root.SMAHTRoot object at 0x136d41460>, vroot_path: ()"}\' # noqa
466
+ #
467
+ if (item_type := re.search(r"https?://.*/(.*)\?skip_indexing=.*", item)) and (len(item_type.groups()) == 1): # noqa
468
+ item_type = to_snake_case(item_type.group(1))
469
+ identifying_value = f"/{to_camel_case(item_type)}{identifying_value}"
452
470
  unresolved_link_error_message_prefix = "Unable to resolve link:"
453
471
  if (i := item.find(unresolved_link_error_message_prefix)) > 0:
454
472
  unresolved_link = item[i + len(unresolved_link_error_message_prefix):].strip()
455
473
  if (i := unresolved_link.find("\"")) > 0:
456
474
  if (unresolved_link := unresolved_link[0:i]):
457
- if ((error_type := re.search(r"https?://.*/(.*)\?skip_indexing=.*", item)) and
458
- (len(error_type.groups()) == 1)): # noqa
459
- error_type = to_camel_case(error_type.group(1))
460
- identifying_value = f"/{error_type}{identifying_value}"
461
- if not loadxl_unresolved.get(identifying_value):
462
- loadxl_unresolved[identifying_value] = []
463
- loadxl_unresolved[identifying_value].append(unresolved_link)
464
- loadxl_total_error_count += 1
465
- continue
466
- item_type = match.group(3)
475
+ if not loadxl_unresolved.get(unresolved_link):
476
+ loadxl_unresolved[unresolved_link] = []
477
+ if identifying_value not in loadxl_unresolved[unresolved_link]:
478
+ loadxl_unresolved[unresolved_link].append(identifying_value)
479
+ if not item_type:
480
+ continue
481
+ else:
482
+ item_type = match.group(3)
467
483
  if current_item_type != item_type:
468
484
  if noprogress and debug and current_item_type is not None:
469
485
  _print()
@@ -482,6 +498,7 @@ def _load_data(portal: Portal, load: str, ini_file: str, explicit_schema_name: O
482
498
  _print(f"{current_item_type}: {current_item_count} or {current_item_total} ({action})")
483
499
  if progress_bar:
484
500
  progress_bar.set_description("▶ Load Complete")
501
+ progress_bar.set_progress(progress_total)
485
502
  if loadxl_total_item_count > loadxl_total_error_count:
486
503
  _print()
487
504
 
@@ -607,16 +624,16 @@ def _load_data(portal: Portal, load: str, ini_file: str, explicit_schema_name: O
607
624
  _print(f"Done loading data into Portal (via snovault.loadxl) from file: {_single_insert_file}")
608
625
  else:
609
626
  _print(f"Done loading data into Portal (via snovault.loadxl) from directory: {inserts_directory}")
610
- _print(f"Total items loaded: {loadxl_total_item_count}"
627
+ _print(f"Total items loaded: {loadxl_total_item_count // 2}" # TODO: straightend out this arithmetic
611
628
  f"{f' (errors: {loadxl_total_error_count})' if loadxl_total_error_count else ''}")
612
629
  for item in sorted(loadxl_summary.keys()):
613
630
  _print(f"▷ {to_camel_case(item)}: {loadxl_summary[item]}")
614
631
  if loadxl_unresolved:
615
632
  _print("✗ Unresolved references:")
616
633
  for item in loadxl_unresolved:
617
- _print(f" {item}: {len(loadxl_unresolved[item])}")
634
+ _print(f" {item}: {len(loadxl_unresolved[item])}")
618
635
  for subitem in loadxl_unresolved[item]:
619
- _print(f" {subitem}")
636
+ _print(f" {subitem}")
620
637
  if debug and loadxl_output:
621
638
  _print("✗ Output from loadxl:")
622
639
  for item in loadxl_output:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.14.0.1b17
3
+ Version: 8.14.0.1b19
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -60,7 +60,7 @@ dcicutils/s3_utils.py,sha256=h2B9ftOo-kxqfiKth5ZDC_cAUFy1Pbu7BrVanFnE5Iw,28839
60
60
  dcicutils/schema_utils.py,sha256=GmRm-XqZKJ6qine16SQF1txcby9WougDav_sYmKNs9E,12400
61
61
  dcicutils/scripts/publish_to_pypi.py,sha256=sMd4WASQGlxlh7uLrt2eGkFRXYgONVmvIg8mClMS5RQ,13903
62
62
  dcicutils/scripts/run_license_checker.py,sha256=z2keYnRDZsHQbTeo1XORAXSXNJK5axVzL5LjiNqZ7jE,4184
63
- dcicutils/scripts/update_portal_object.py,sha256=MsNpF6eHGVxr7dUg8QrwZo9XfIjPjAavOWqyI_RrfpA,38397
63
+ dcicutils/scripts/update_portal_object.py,sha256=Xp1Jho_LC9gkaR6pV3Jvukxx27LW2N18ucDgxz6gc9w,39639
64
64
  dcicutils/scripts/view_portal_object.py,sha256=lcgXWH9ooVf7tJDIRnoFGOgT0wYLGhiJlJW3a9w6A_c,36983
65
65
  dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19745
66
66
  dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
@@ -75,8 +75,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
75
75
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
76
76
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
77
77
  dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
78
- dcicutils-8.14.0.1b17.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
- dcicutils-8.14.0.1b17.dist-info/METADATA,sha256=WxgzreGqLqRZT1QRIzME9quTpxihdyduDQKkxX9kdS0,3440
80
- dcicutils-8.14.0.1b17.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
- dcicutils-8.14.0.1b17.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
- dcicutils-8.14.0.1b17.dist-info/RECORD,,
78
+ dcicutils-8.14.0.1b19.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
+ dcicutils-8.14.0.1b19.dist-info/METADATA,sha256=fNFLeE-npH786qVeBJgJemerLOwaIGYkbOT1jZWKqKs,3440
80
+ dcicutils-8.14.0.1b19.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
+ dcicutils-8.14.0.1b19.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
+ dcicutils-8.14.0.1b19.dist-info/RECORD,,