dcicutils 8.14.0.1b7__py3-none-any.whl → 8.14.0.1b9__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.
- dcicutils/scripts/update_portal_object.py +38 -3
- dcicutils/scripts/view_portal_object.py +7 -11
- {dcicutils-8.14.0.1b7.dist-info → dcicutils-8.14.0.1b9.dist-info}/METADATA +1 -1
- {dcicutils-8.14.0.1b7.dist-info → dcicutils-8.14.0.1b9.dist-info}/RECORD +7 -7
- {dcicutils-8.14.0.1b7.dist-info → dcicutils-8.14.0.1b9.dist-info}/LICENSE.txt +0 -0
- {dcicutils-8.14.0.1b7.dist-info → dcicutils-8.14.0.1b9.dist-info}/WHEEL +0 -0
- {dcicutils-8.14.0.1b7.dist-info → dcicutils-8.14.0.1b9.dist-info}/entry_points.txt +0 -0
@@ -38,6 +38,7 @@ class Portal(PortalFromUtils):
|
|
38
38
|
|
39
39
|
_DEFAULT_APP = "smaht"
|
40
40
|
_SMAHT_ENV_ENVIRON_NAME = "SMAHT_ENV"
|
41
|
+
_DEFAULT_INI_FILE_FOR_LOAD = "development.ini"
|
41
42
|
|
42
43
|
# Schema properties to ignore (by default) for the view schema usage.
|
43
44
|
_IGNORE_PROPERTIES_ON_UPDATE = [
|
@@ -120,6 +121,8 @@ def main():
|
|
120
121
|
parser.add_argument("--post", type=str, required=False, default=None, help="POST data.")
|
121
122
|
parser.add_argument("--patch", type=str, required=False, default=None, help="PATCH data.")
|
122
123
|
parser.add_argument("--upsert", type=str, required=False, default=None, help="Upsert data.")
|
124
|
+
parser.add_argument("--load", type=str, required=False, default=None, help="Load data via snovault.loadxl.")
|
125
|
+
parser.add_argument("--ini", type=str, required=False, default=None, help="INI file for data via snovault.loadxl.")
|
123
126
|
parser.add_argument("--delete", type=str, required=False, default=None, help="Delete data.")
|
124
127
|
parser.add_argument("--purge", type=str, required=False, default=None, help="Purge data.")
|
125
128
|
parser.add_argument("--noignore", action="store_true", required=False, default=False,
|
@@ -143,6 +146,41 @@ def main():
|
|
143
146
|
else:
|
144
147
|
app = APP_SMAHT
|
145
148
|
|
149
|
+
if not (args.post or args.patch or args.upsert or args.delete or args.purge or args.load):
|
150
|
+
usage()
|
151
|
+
|
152
|
+
if args.load:
|
153
|
+
if args.post or args.patch or args.upsert or args.delete or args.purge:
|
154
|
+
_print("Cannot use any other update option"
|
155
|
+
"when using the --load option (to load data via snovault.loadxl).")
|
156
|
+
exit(1)
|
157
|
+
if args.env:
|
158
|
+
_print("The --env is not used for the --load option (to load data via snovault.loadxl).")
|
159
|
+
if args.schema:
|
160
|
+
_print("The --schema is not used for the --load option (to load data via snovault.loadxl).")
|
161
|
+
from snovault.loadxl import load_data
|
162
|
+
from dcicutils.captured_output import captured_output
|
163
|
+
if args.ini:
|
164
|
+
ini_file = args.ini
|
165
|
+
else:
|
166
|
+
ini_file = _DEFAULT_INI_FILE_FOR_LOAD
|
167
|
+
if not os.path.exists(ini_file):
|
168
|
+
_print(f"The INI file required for --load is not found: {ini_file}")
|
169
|
+
exit(1)
|
170
|
+
if not os.path.isdir(args.load):
|
171
|
+
_print(f"Load directory does not exist: {args.load}")
|
172
|
+
exit(1)
|
173
|
+
portal = None
|
174
|
+
with captured_output(not args.debug):
|
175
|
+
portal = Portal(ini_file)
|
176
|
+
if args.verbose:
|
177
|
+
_print(f"Loading data files into Portal (via snovault.loadxl) from: {args.load}")
|
178
|
+
_print(f"Portal INI file for load is: {ini_file}")
|
179
|
+
load_data(portal.vapp, indir=args.load, overwrite=True, use_master_inserts=False)
|
180
|
+
if args.verbose:
|
181
|
+
_print(f"Done loading data into Portal (via snovault.loadxl) files from: {args.load}")
|
182
|
+
exit(0)
|
183
|
+
|
146
184
|
portal = _create_portal(env=args.env, app=app, verbose=args.verbose, debug=args.debug)
|
147
185
|
|
148
186
|
if explicit_schema_name := args.schema:
|
@@ -150,9 +188,6 @@ def main():
|
|
150
188
|
if not schema:
|
151
189
|
usage(f"ERROR: Unknown schema name: {args.schema}")
|
152
190
|
|
153
|
-
if not (args.post or args.patch or args.upsert or args.delete or args.purge):
|
154
|
-
usage()
|
155
|
-
|
156
191
|
if args.post:
|
157
192
|
_post_or_patch_or_upsert(portal=portal,
|
158
193
|
file_or_directory=args.post,
|
@@ -330,6 +330,8 @@ def _get_portal_object(portal: Portal, uuid: str,
|
|
330
330
|
results_total = len(results)
|
331
331
|
for result in results:
|
332
332
|
results_index += 1
|
333
|
+
if debug:
|
334
|
+
print(f"Processing result: {results_index}")
|
333
335
|
result.pop("schema_version", None)
|
334
336
|
result = prune_data(result)
|
335
337
|
if (subtypes and one_or_more_objects_of_types_exists(portal, subtypes, debug=debug) and
|
@@ -374,14 +376,7 @@ def _get_portal_object(portal: Portal, uuid: str,
|
|
374
376
|
|
375
377
|
def one_or_more_objects_of_types_exists(portal: Portal, schema_types: List[str], debug: bool = False) -> bool:
|
376
378
|
for schema_type in schema_types:
|
377
|
-
|
378
|
-
if one_or_more_objects_of_type_exists(portal, schema_type, debug=debug):
|
379
|
-
return True
|
380
|
-
response = portal.get(f"/{schema_type}")
|
381
|
-
if response and response.status_code == 404:
|
382
|
-
_print(f"There are no objects of sub-type: {schema_type}")
|
383
|
-
return False
|
384
|
-
except Exception:
|
379
|
+
if one_or_more_objects_of_type_exists(portal, schema_type, debug=debug):
|
385
380
|
return True
|
386
381
|
return False
|
387
382
|
|
@@ -393,14 +388,15 @@ def one_or_more_objects_of_type_exists(portal: Portal, schema_type: str, debug:
|
|
393
388
|
_print(f"Checking if there are actually any objects of type: {schema_type}")
|
394
389
|
if portal.get(f"/{schema_type}").status_code == 404:
|
395
390
|
if debug:
|
396
|
-
_print(f"No
|
391
|
+
_print(f"No objects of type actually exist: {schema_type}")
|
392
|
+
return False
|
397
393
|
else:
|
398
394
|
if debug:
|
399
395
|
_print(f"One or more objects of type exist: {schema_type}")
|
400
396
|
except Exception as e:
|
401
|
-
_print(f"ERROR:
|
397
|
+
_print(f"ERROR: Cannot determine if there are actually any objects of type: {schema_type}")
|
402
398
|
_print(e)
|
403
|
-
return
|
399
|
+
return True
|
404
400
|
|
405
401
|
|
406
402
|
@lru_cache(maxsize=1)
|
@@ -60,8 +60,8 @@ 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=
|
64
|
-
dcicutils/scripts/view_portal_object.py,sha256=
|
63
|
+
dcicutils/scripts/update_portal_object.py,sha256=9_ZpfKwIJUDbyEI0Xqu_9keMxTIVZ_CyxX8WeGrFI14,24376
|
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
|
67
67
|
dcicutils/snapshot_utils.py,sha256=YDeI3vD-MhAtHwKDzfEm2q-n3l-da2yRpRR3xp0Ah1M,23021
|
@@ -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.
|
79
|
-
dcicutils-8.14.0.
|
80
|
-
dcicutils-8.14.0.
|
81
|
-
dcicutils-8.14.0.
|
82
|
-
dcicutils-8.14.0.
|
78
|
+
dcicutils-8.14.0.1b9.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
|
79
|
+
dcicutils-8.14.0.1b9.dist-info/METADATA,sha256=6dzBhVwY1DNx4-lCS_3FSaztYt-JC8bNFU9o8VoyycA,3439
|
80
|
+
dcicutils-8.14.0.1b9.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
81
|
+
dcicutils-8.14.0.1b9.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
|
82
|
+
dcicutils-8.14.0.1b9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|