streamlit-octostar-utils 0.2.11__py3-none-any.whl → 0.2.12__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.
- streamlit_octostar_utils/api_crafter/nifi.py +147 -75
- streamlit_octostar_utils/ontology/inheritance.py +4 -2
- {streamlit_octostar_utils-0.2.11.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/METADATA +1 -1
- {streamlit_octostar_utils-0.2.11.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/RECORD +6 -6
- {streamlit_octostar_utils-0.2.11.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/WHEEL +0 -0
- {streamlit_octostar_utils-0.2.11.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/licenses/LICENSE +0 -0
@@ -163,12 +163,16 @@ class NifiEntityProxy(object):
|
|
163
163
|
if child_entity.uid == uid_to_search:
|
164
164
|
found_entity = child_entity
|
165
165
|
else:
|
166
|
-
found_entity = _recursive_search_expanded_proxy(
|
166
|
+
found_entity = _recursive_search_expanded_proxy(
|
167
|
+
child_entity._proxy, uid_to_search
|
168
|
+
)
|
167
169
|
if found_entity:
|
168
170
|
return found_entity
|
169
171
|
|
170
172
|
if not self._proxy:
|
171
|
-
main_entities = itertools.chain(
|
173
|
+
main_entities = itertools.chain(
|
174
|
+
*[b.entities for b in self.context.in_batches]
|
175
|
+
)
|
172
176
|
main_entities = {e.record["entity_id"]: e for e in main_entities}
|
173
177
|
if main_entities.get(self.uid):
|
174
178
|
self._proxy = main_entities.get(self.uid)
|
@@ -179,7 +183,9 @@ class NifiEntityProxy(object):
|
|
179
183
|
self._proxy = found_entity._proxy
|
180
184
|
return self._proxy
|
181
185
|
## TODO: Try to get the entity from the database with query_ontology()
|
182
|
-
raise AttributeError(
|
186
|
+
raise AttributeError(
|
187
|
+
f"Cannot find children with UUID {self.uid}! It may exist in the database?"
|
188
|
+
)
|
183
189
|
|
184
190
|
def __getattr__(self, name):
|
185
191
|
if name in self.__dict__:
|
@@ -213,24 +219,28 @@ class NifiFragmenter(object):
|
|
213
219
|
raise ValueError("Must have at least 2 entities for fragmentation")
|
214
220
|
identifier = str(uuid.uuid4())
|
215
221
|
for i, entity in enumerate(fragments):
|
216
|
-
travel_dict(
|
217
|
-
|
218
|
-
)
|
222
|
+
travel_dict(
|
223
|
+
entity.request["nifi_attributes"], fragmenter_keylist.split("."), "w"
|
224
|
+
)({"identifier": identifier, "count": count, "index": i})
|
219
225
|
if "fragment" not in entity.request["config"]:
|
220
226
|
entity.request["config"]["fragment"] = {}
|
221
227
|
if "fragments_stack" not in entity.request["config"]["fragment"]:
|
222
228
|
entity.request["config"]["fragment"]["fragments_stack"] = []
|
223
|
-
entity.request["config"]["fragment"]["fragments_stack"].insert(
|
224
|
-
|
225
|
-
"fragments_stack"
|
226
|
-
]
|
227
|
-
travel_dict(entity.request["config"]["fragment"], fragmenter_keylist.split("."), "w")(
|
228
|
-
{"identifier": identifier, "count": count, "index": i}
|
229
|
+
entity.request["config"]["fragment"]["fragments_stack"].insert(
|
230
|
+
0, fragmenter_keylist
|
229
231
|
)
|
232
|
+
entity.request["nifi_attributes"]["fragments_stack"] = entity.request[
|
233
|
+
"config"
|
234
|
+
]["fragment"]["fragments_stack"]
|
235
|
+
travel_dict(
|
236
|
+
entity.request["config"]["fragment"], fragmenter_keylist.split("."), "w"
|
237
|
+
)({"identifier": identifier, "count": count, "index": i})
|
230
238
|
|
231
239
|
def push_defragment_strategy(fragment, defragmenter_config):
|
232
240
|
pointer = fragment.request["config"]
|
233
|
-
last_fragmenter_keylist = fragment.request["config"]["fragment"][
|
241
|
+
last_fragmenter_keylist = fragment.request["config"]["fragment"][
|
242
|
+
"fragments_stack"
|
243
|
+
][0]
|
234
244
|
for k in ("fragment." + last_fragmenter_keylist).split("."):
|
235
245
|
if not pointer.get(k):
|
236
246
|
pointer[k] = {}
|
@@ -249,7 +259,7 @@ class NifiEntityBatch(object):
|
|
249
259
|
|
250
260
|
class NifiContextManager(object):
|
251
261
|
HEADLESS_PROCESSOR_NAME = "headless"
|
252
|
-
|
262
|
+
|
253
263
|
class SyncFlag(Enum):
|
254
264
|
UPSERT_ENTITY_ALL = 0 # bool
|
255
265
|
UPSERT_ENTITY_SPECIFIC_FIELDS = 1 # 'fields': list of record fields
|
@@ -270,7 +280,9 @@ class NifiContextManager(object):
|
|
270
280
|
@property
|
271
281
|
def ontology(self):
|
272
282
|
if not self._ontology:
|
273
|
-
self._ontology = fetch_ontology_data.sync(
|
283
|
+
self._ontology = fetch_ontology_data.sync(
|
284
|
+
ontology_name=self.ontology_name, client=self.client
|
285
|
+
)
|
274
286
|
return self._ontology
|
275
287
|
|
276
288
|
def _config_get(entity, keylist):
|
@@ -339,7 +351,9 @@ class NifiContextManager(object):
|
|
339
351
|
return self
|
340
352
|
|
341
353
|
def get_workspaces_permissions(self, workspace_ids):
|
342
|
-
permissions_to_fetch = list(
|
354
|
+
permissions_to_fetch = list(
|
355
|
+
set(workspace_ids).difference(set(list(self.permissions.keys())))
|
356
|
+
)
|
343
357
|
if permissions_to_fetch:
|
344
358
|
permissions = get_permissions.sync(permissions_to_fetch, client=self.client)
|
345
359
|
self.permissions.update(permissions)
|
@@ -369,13 +383,18 @@ class NifiContextManager(object):
|
|
369
383
|
entities.append(entity)
|
370
384
|
for child_entity in entity.children_entities:
|
371
385
|
if not child_entity.drop_on_output:
|
372
|
-
if
|
386
|
+
if (
|
387
|
+
child_entity.output_as_independent
|
388
|
+
or child_entity.output_as_child
|
389
|
+
):
|
373
390
|
if processor_name != NifiContextManager.HEADLESS_PROCESSOR_NAME:
|
374
391
|
child_entity.request["last_processor_name"] = processor_name
|
375
392
|
if child_entity.output_as_independent:
|
376
393
|
if not child_entity._proxy:
|
377
394
|
child_entity.fetch_proxy()
|
378
|
-
entities.extend(
|
395
|
+
entities.extend(
|
396
|
+
_process_entity(child_entity._proxy, processor_name)
|
397
|
+
)
|
379
398
|
return entities
|
380
399
|
|
381
400
|
entities = itertools.chain(*[b.entities for b in entity_batches])
|
@@ -386,7 +405,9 @@ class NifiContextManager(object):
|
|
386
405
|
all_entities,
|
387
406
|
key=lambda x: string_to_datetime(x.record.get("os_last_updated_at")),
|
388
407
|
)
|
389
|
-
self.out_entities = list(
|
408
|
+
self.out_entities = list(
|
409
|
+
{e.record["entity_id"]: e for e in all_entities}.values()
|
410
|
+
)
|
390
411
|
self.sync_entities()
|
391
412
|
return [entity for entity in self.jsonify(self.out_entities)["content"]]
|
392
413
|
|
@@ -394,19 +415,23 @@ class NifiContextManager(object):
|
|
394
415
|
error_response = DefaultErrorRoute.format_error(exc)
|
395
416
|
entity.request["exception"]["code"] = error_response.status_code
|
396
417
|
entity.request["exception"]["body"] = json.loads(error_response.body)["message"]
|
397
|
-
travel_dict(
|
398
|
-
entity.request["
|
399
|
-
)
|
400
|
-
travel_dict(
|
401
|
-
entity.request["
|
402
|
-
)
|
418
|
+
travel_dict(
|
419
|
+
entity.request["nifi_attributes"], ["invokehttp", "response", "body"], "w"
|
420
|
+
)(entity.request["exception"]["body"])
|
421
|
+
travel_dict(
|
422
|
+
entity.request["nifi_attributes"], ["invokehttp", "response", "code"], "w"
|
423
|
+
)(entity.request["exception"]["code"])
|
403
424
|
entity.request["nifi_attributes"]["raised_exc"] = True
|
404
425
|
|
405
426
|
def sync_entities(self):
|
406
427
|
if not self.lazy_sync:
|
407
428
|
entities = self.out_entities
|
408
429
|
else:
|
409
|
-
entities = [
|
430
|
+
entities = [
|
431
|
+
e
|
432
|
+
for e in self.out_entities
|
433
|
+
if e.record["entity_id"] in self.nonlazy_sync_ids
|
434
|
+
]
|
410
435
|
if not entities:
|
411
436
|
return
|
412
437
|
reserved_fields = [
|
@@ -436,16 +461,18 @@ class NifiContextManager(object):
|
|
436
461
|
for entity in entities:
|
437
462
|
if entity.sync_params.get(NifiContextManager.SyncFlag.FETCH_RELATIONSHIPS):
|
438
463
|
concept_name = entity.record["entity_type"]
|
439
|
-
rels_to_fetch = entity.sync_params.get(
|
464
|
+
rels_to_fetch = entity.sync_params.get(
|
465
|
+
NifiContextManager.SyncFlag.FETCH_RELATIONSHIPS, []
|
466
|
+
)
|
440
467
|
for rel in rels_to_fetch:
|
441
468
|
if rel not in fetch_relationships_entities:
|
442
469
|
fetch_relationships_entities[rel] = []
|
443
470
|
fetch_relationships_entities[rel].append(entity)
|
444
471
|
if concept_name not in fetch_concept_relationships:
|
445
472
|
fetch_concept_relationships[concept_name] = set()
|
446
|
-
fetch_concept_relationships[concept_name] = fetch_concept_relationships[
|
447
|
-
|
448
|
-
)
|
473
|
+
fetch_concept_relationships[concept_name] = fetch_concept_relationships[
|
474
|
+
concept_name
|
475
|
+
].union(set(rels_to_fetch))
|
449
476
|
for k in fetch_concept_relationships.keys():
|
450
477
|
fetch_concept_relationships[k] = list(fetch_concept_relationships[k])
|
451
478
|
# UPSERT ENTITIES
|
@@ -491,7 +518,7 @@ class NifiContextManager(object):
|
|
491
518
|
file.request["is_temporary"] = False
|
492
519
|
file.request["entity_timestamp"] = file.record["os_last_updated_at"]
|
493
520
|
# FETCH RELATIONSHIPS
|
494
|
-
|
521
|
+
'''
|
495
522
|
if fetch_relationships_entities:
|
496
523
|
relationship_mappings_info = relationship_mappings.sync_detailed(
|
497
524
|
client=self.client
|
@@ -547,7 +574,7 @@ class NifiContextManager(object):
|
|
547
574
|
child_rel.request["entity_timestamp"] = rel.get(
|
548
575
|
"os_last_updated_at"
|
549
576
|
)
|
550
|
-
|
577
|
+
'''
|
551
578
|
# CLEAN SYNC PARAMS
|
552
579
|
for entity in entities:
|
553
580
|
entity.sync_params = {}
|
@@ -556,10 +583,15 @@ class NifiContextManager(object):
|
|
556
583
|
for entity in entities:
|
557
584
|
fields = set()
|
558
585
|
|
559
|
-
if
|
586
|
+
if (
|
587
|
+
entity.sync_params.get(NifiContextManager.SyncFlag.UPSERT_ENTITY_ALL)
|
588
|
+
or entity.request["is_temporary"]
|
589
|
+
):
|
560
590
|
fields = fields.union(set(list(entity.record.keys())))
|
561
591
|
|
562
|
-
if entity.sync_params.get(
|
592
|
+
if entity.sync_params.get(
|
593
|
+
NifiContextManager.SyncFlag.UPSERT_ENTITY_SPECIFIC_FIELDS
|
594
|
+
):
|
563
595
|
fields = fields.union(
|
564
596
|
set(
|
565
597
|
entity.sync_params.get(
|
@@ -570,7 +602,9 @@ class NifiContextManager(object):
|
|
570
602
|
)
|
571
603
|
)
|
572
604
|
if fields:
|
573
|
-
entities_to_upsert.append(
|
605
|
+
entities_to_upsert.append(
|
606
|
+
(entity, [f for f in list(fields) if f not in reserved_fields])
|
607
|
+
)
|
574
608
|
|
575
609
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
576
610
|
if exc_val is not None:
|
@@ -584,7 +618,9 @@ class NifiContextManager(object):
|
|
584
618
|
for entity in entities:
|
585
619
|
if isinstance(entity, NifiEntityProxy):
|
586
620
|
children.extend(entity.children_entities)
|
587
|
-
children.extend(
|
621
|
+
children.extend(
|
622
|
+
_recursive_collect_proxies(entity.children_entities)
|
623
|
+
)
|
588
624
|
return children
|
589
625
|
|
590
626
|
all_proxies = _recursive_collect_proxies(entities)
|
@@ -597,21 +633,15 @@ class NifiContextManager(object):
|
|
597
633
|
|
598
634
|
|
599
635
|
class NifiEntity(object):
|
600
|
-
def __init__(
|
636
|
+
def __init__(
|
637
|
+
self, context, request, record, annotations, all_independent_uids, children=[], contents=None
|
638
|
+
):
|
601
639
|
self.context = context
|
602
640
|
self.request = request
|
603
641
|
self.record = record
|
604
642
|
self.annotations = annotations
|
605
|
-
assert (
|
606
|
-
|
607
|
-
and self.record.get("entity_id")
|
608
|
-
and self.record["os_entity_uid"] == self.record["entity_id"]
|
609
|
-
)
|
610
|
-
assert (
|
611
|
-
self.record.get("os_concept")
|
612
|
-
and self.record.get("entity_type")
|
613
|
-
and self.record["os_concept"] == self.record["entity_type"]
|
614
|
-
)
|
643
|
+
assert self.record.get("os_entity_uid") and self.record.get("entity_id") and self.record["os_entity_uid"] == self.record["entity_id"]
|
644
|
+
assert self.record.get("os_concept") and self.record.get("entity_type") and self.record["os_concept"] == self.record["entity_type"]
|
615
645
|
if "entity_label" not in self.record:
|
616
646
|
self.record["entity_label"] = self.label
|
617
647
|
children = [c for c in children if isinstance(c, (str, dict))]
|
@@ -631,7 +661,9 @@ class NifiEntity(object):
|
|
631
661
|
child_types = [c["entity_type"] for c in proxy_entity_children] + [
|
632
662
|
c["record"]["entity_type"] for c in full_entity_children
|
633
663
|
]
|
634
|
-
output_as_child = [False] * len(proxy_entity_children) + [True] * len(
|
664
|
+
output_as_child = [False] * len(proxy_entity_children) + [True] * len(
|
665
|
+
full_entity_children
|
666
|
+
)
|
635
667
|
output_as_independent = [uid in all_independent_uids for uid in child_uids]
|
636
668
|
full_entity_children = [
|
637
669
|
NifiEntity(
|
@@ -645,7 +677,9 @@ class NifiEntity(object):
|
|
645
677
|
)
|
646
678
|
for c in full_entity_children
|
647
679
|
]
|
648
|
-
proxy_otm_children = [
|
680
|
+
proxy_otm_children = [
|
681
|
+
NifiOTMRelationshipProxy(**otm_child) for otm_child in proxy_otm_children
|
682
|
+
]
|
649
683
|
child_proxies = [None] * len(proxy_entity_children) + full_entity_children
|
650
684
|
self.children = [
|
651
685
|
NifiEntityProxy(
|
@@ -673,18 +707,21 @@ class NifiEntity(object):
|
|
673
707
|
|
674
708
|
@property
|
675
709
|
def sync_params(self):
|
676
|
-
return {
|
710
|
+
return {
|
711
|
+
NifiContextManager.SyncFlag[k]: v
|
712
|
+
for k, v in (self.request.get("sync_params") or {}).items()
|
713
|
+
}
|
677
714
|
|
678
715
|
@sync_params.setter
|
679
716
|
def sync_params(self, new_params):
|
680
717
|
self.request["sync_params"] = {
|
681
|
-
(k.name if isinstance(k, NifiContextManager.SyncFlag) else k): v
|
718
|
+
(k.name if isinstance(k, NifiContextManager.SyncFlag) else k): v
|
719
|
+
for k, v in new_params.items()
|
682
720
|
}
|
683
721
|
|
684
722
|
@property
|
685
723
|
def metadata(self):
|
686
724
|
return self.annotations
|
687
|
-
|
688
725
|
@metadata.setter
|
689
726
|
def metadata(self, new_metadata):
|
690
727
|
self.annotations = new_metadata
|
@@ -707,7 +744,9 @@ class NifiEntity(object):
|
|
707
744
|
contents_pointer = deepcopy(self.request["contents_pointer"])
|
708
745
|
ptr_location = contents_pointer.get("location")
|
709
746
|
if ptr_location == "attachment" and not contents_pointer.get("pointer"):
|
710
|
-
contents_pointer["pointer"] =
|
747
|
+
contents_pointer["pointer"] = (
|
748
|
+
f"{self.record['os_workspace']}/{self.record['os_entity_uid']}"
|
749
|
+
)
|
711
750
|
return self.request["contents_pointer"]
|
712
751
|
|
713
752
|
@contents_pointer.setter
|
@@ -727,7 +766,9 @@ class NifiEntity(object):
|
|
727
766
|
return list(
|
728
767
|
filter(
|
729
768
|
lambda x: isinstance(x, NifiOTMRelationshipProxy)
|
730
|
-
or is_child_concept_fn(
|
769
|
+
or is_child_concept_fn(
|
770
|
+
x.entity_type, RELATIONSHIP_ENTITY_NAME, self.context.ontology
|
771
|
+
),
|
731
772
|
self.children,
|
732
773
|
)
|
733
774
|
)
|
@@ -746,12 +787,18 @@ class NifiEntity(object):
|
|
746
787
|
)
|
747
788
|
if (
|
748
789
|
self.record.get("os_workspace")
|
749
|
-
and (
|
790
|
+
and (
|
791
|
+
permissions.get(self.record.get("os_workspace")) or PermissionLevel.NONE
|
792
|
+
)
|
793
|
+
>= PermissionLevel.WRITE
|
750
794
|
):
|
751
795
|
return self.record["os_workspace"]
|
752
796
|
elif (
|
753
797
|
self.request.get("fallback_os_workspace")
|
754
|
-
and (
|
798
|
+
and (
|
799
|
+
permissions.get(self.request.get("fallback_os_workspace"))
|
800
|
+
or PermissionLevel.NONE
|
801
|
+
)
|
755
802
|
>= PermissionLevel.WRITE
|
756
803
|
):
|
757
804
|
return self.request["fallback_os_workspace"]
|
@@ -760,7 +807,7 @@ class NifiEntity(object):
|
|
760
807
|
|
761
808
|
@property
|
762
809
|
def label(self):
|
763
|
-
label_keys = self.request["
|
810
|
+
label_keys = self.request["ontology_info"]["label_keys"]
|
764
811
|
label = " ".join([(self.record.get(field) or "") for field in label_keys]).strip()
|
765
812
|
if not label:
|
766
813
|
label = None
|
@@ -785,10 +832,14 @@ class NifiEntity(object):
|
|
785
832
|
entity_type = None
|
786
833
|
if isinstance(self, NifiEntityProxy):
|
787
834
|
entity_type = self.entity_type
|
788
|
-
return entity_type == type or is_child_concept_fn(
|
835
|
+
return entity_type == type or is_child_concept_fn(
|
836
|
+
entity_type, type, self.context.ontology
|
837
|
+
)
|
789
838
|
else:
|
790
839
|
entity_type = self.record["entity_type"]
|
791
|
-
return
|
840
|
+
return (
|
841
|
+
entity_type == type or type in self.request["ontology_info"]["parents"]
|
842
|
+
)
|
792
843
|
|
793
844
|
def is_fragmented(self) -> bool:
|
794
845
|
return bool(self.request["config"].get("fragment", {}).get("fragments_stack"))
|
@@ -804,7 +855,7 @@ class NifiEntity(object):
|
|
804
855
|
if _is_sub_fragment_recursive(value):
|
805
856
|
return True
|
806
857
|
return False
|
807
|
-
|
858
|
+
|
808
859
|
if not self.is_fragmented():
|
809
860
|
return True
|
810
861
|
fragment = entity.request.get("config", {}).get("fragment", {})
|
@@ -831,7 +882,10 @@ class NifiEntity(object):
|
|
831
882
|
else:
|
832
883
|
proxy_entity_children.append(child)
|
833
884
|
proxy_entity_children = list({c.uid: c for c in proxy_entity_children}.values())
|
834
|
-
proxy_entity_children = [
|
885
|
+
proxy_entity_children = [
|
886
|
+
{"entity_id": c.uid, "entity_type": c.entity_type}
|
887
|
+
for c in proxy_entity_children
|
888
|
+
]
|
835
889
|
proxy_otm_children = list(
|
836
890
|
{
|
837
891
|
c.record["os_entity_uid_from"]
|
@@ -847,7 +901,9 @@ class NifiEntity(object):
|
|
847
901
|
full_entity_children,
|
848
902
|
key=lambda x: string_to_datetime(x.record.get("os_last_updated_at")),
|
849
903
|
)
|
850
|
-
full_entity_children = list(
|
904
|
+
full_entity_children = list(
|
905
|
+
{c.uid: c.to_json() for c in full_entity_children}.values()
|
906
|
+
)
|
851
907
|
children = full_entity_children + proxy_entity_children + proxy_otm_children
|
852
908
|
return {
|
853
909
|
"request": self.request,
|
@@ -862,9 +918,9 @@ class NifiEntity(object):
|
|
862
918
|
random_id = str(uuid.uuid4())
|
863
919
|
username = self.jwt_data["username"]
|
864
920
|
if entity_type == self.record["entity_type"]:
|
865
|
-
ont_parents = self.request["
|
866
|
-
ont_relationships = self.request["
|
867
|
-
ont_label_keys = self.request["
|
921
|
+
ont_parents = self.request["ontology_info"]["parents"]
|
922
|
+
ont_relationships = self.request["ontology_info"]["relationships"]
|
923
|
+
ont_label_keys = self.request["ontology_info"]["label_keys"]
|
868
924
|
else:
|
869
925
|
ont_parents = self.context.ontology["concepts"][entity_type]["parents"]
|
870
926
|
ont_relationships = self.context.ontology["concepts"][entity_type]["relationships"]
|
@@ -931,7 +987,11 @@ class NifiEntity(object):
|
|
931
987
|
):
|
932
988
|
return self._add_entity(
|
933
989
|
os_relationship_workspace,
|
934
|
-
(
|
990
|
+
(
|
991
|
+
LOCAL_RELATIONSHIP_ENTITY_NAME
|
992
|
+
if os_relationship_workspace
|
993
|
+
else RELATIONSHIP_ENTITY_NAME
|
994
|
+
),
|
935
995
|
{
|
936
996
|
**relationship_fields,
|
937
997
|
"os_entity_uid_from": os_entity_uid_from,
|
@@ -1013,7 +1073,9 @@ class NifiEntity(object):
|
|
1013
1073
|
os_relationship_type,
|
1014
1074
|
)
|
1015
1075
|
child_entity._contents = file
|
1016
|
-
child_entity.request["contents_pointer"] =
|
1076
|
+
child_entity.request["contents_pointer"] = (
|
1077
|
+
NifiEntityModel.RequestModel.ContentsPointerModel(location="local")
|
1078
|
+
)
|
1017
1079
|
return child_entity, child_rel
|
1018
1080
|
|
1019
1081
|
def add_tag(self, os_workspace, name, group, order, color):
|
@@ -1026,20 +1088,21 @@ class NifiEntity(object):
|
|
1026
1088
|
)
|
1027
1089
|
|
1028
1090
|
def add_metadata(
|
1029
|
-
self,
|
1030
|
-
json,
|
1031
|
-
merge_method: Callable[[Any, Any], Any],
|
1032
|
-
recurse: Union[bool, int] = False,
|
1091
|
+
self, json, merge_method: Callable[[Any, Any], Any], recurse: Union[bool, int] = False,
|
1033
1092
|
):
|
1034
1093
|
if not self.metadata:
|
1035
1094
|
self.metadata = {}
|
1036
|
-
self.metadata = recursive_update_dict(
|
1095
|
+
self.metadata = recursive_update_dict(
|
1096
|
+
self.metadata, json, merge_method, recurse
|
1097
|
+
)
|
1037
1098
|
|
1038
1099
|
def propagate_metadata(self, to_entity, fields=None, merge_method=lambda _, v2: v2):
|
1039
1100
|
metadata_to_propagate = deepcopy(self.metadata)
|
1040
1101
|
if fields:
|
1041
1102
|
metadata_to_propagate = {k: v for k, v in self.metadata if k in fields}
|
1042
|
-
to_entity.metadata = recursive_update_dict(
|
1103
|
+
to_entity.metadata = recursive_update_dict(
|
1104
|
+
to_entity.metadata, metadata_to_propagate, merge_method
|
1105
|
+
)
|
1043
1106
|
|
1044
1107
|
|
1045
1108
|
def more_recent_than(record_a, record_b):
|
@@ -1098,10 +1161,19 @@ class NifiRoute(Route):
|
|
1098
1161
|
query_params = request.query_params
|
1099
1162
|
processor_suffix = query_params["processor_suffix"]
|
1100
1163
|
body = await request.json()
|
1101
|
-
processor_name =
|
1164
|
+
processor_name = (
|
1165
|
+
"processor."
|
1166
|
+
+ self.processor_name
|
1167
|
+
+ "."
|
1168
|
+
+ op.replace("-", "_")
|
1169
|
+
+ "."
|
1170
|
+
+ processor_suffix
|
1171
|
+
)
|
1102
1172
|
if op not in self.endpoints.keys():
|
1103
1173
|
raise StarletteHTTPException(401, f"Route {op} is forbidden for NiFi.")
|
1104
|
-
task_id = await self.celery_executor.send_task(
|
1174
|
+
task_id = await self.celery_executor.send_task(
|
1175
|
+
self.endpoints[op], args=[body, processor_name]
|
1176
|
+
)
|
1105
1177
|
return task_id
|
1106
1178
|
|
1107
1179
|
@staticmethod
|
@@ -2,7 +2,9 @@ def is_child_concept(type, parent_type, ontology):
|
|
2
2
|
return type == parent_type or parent_type in ontology["concepts"][type]["parents"]
|
3
3
|
|
4
4
|
def get_label_keys(type, ontology):
|
5
|
-
parents =
|
5
|
+
parents = set(ontology["concepts"][type]["parents"])
|
6
|
+
parents.add(type)
|
7
|
+
parents = list(parents)
|
6
8
|
parents.reverse()
|
7
9
|
label_keys = {} # for guaranteed insertion order
|
8
10
|
for parent in parents:
|
@@ -10,4 +12,4 @@ def get_label_keys(type, ontology):
|
|
10
12
|
if not label_key:
|
11
13
|
continue
|
12
14
|
label_keys[label_key] = None
|
13
|
-
return list(label_keys.keys())
|
15
|
+
return list(label_keys.keys())
|
{streamlit_octostar_utils-0.2.11.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/RECORD
RENAMED
@@ -2,7 +2,7 @@ streamlit_octostar_utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-Y
|
|
2
2
|
streamlit_octostar_utils/api_crafter/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
3
3
|
streamlit_octostar_utils/api_crafter/celery.py,sha256=BXOTGN9egdD75qf-PkccLGAoniilB9PZ_NRchFIjWdw,30051
|
4
4
|
streamlit_octostar_utils/api_crafter/fastapi.py,sha256=RKQrStPzG1I1pxsPJvGs_DRrnjlMJbVmu9ObMF2LgZ0,14368
|
5
|
-
streamlit_octostar_utils/api_crafter/nifi.py,sha256=
|
5
|
+
streamlit_octostar_utils/api_crafter/nifi.py,sha256=6PSWIFKjv8nzlFGH9IFRI3VrYsISNjDIPyi1RvLJoKk,45810
|
6
6
|
streamlit_octostar_utils/api_crafter/parser/__init__.py,sha256=YeYWF6sdQiCFV_RKNW2t9Vs6KJExE2pbXxWTe_DOayY,107
|
7
7
|
streamlit_octostar_utils/api_crafter/parser/combine_fields.py,sha256=ddc44xkajw8MU0peAX_263DL7rPXbTKbHUjpOhRgvyU,8790
|
8
8
|
streamlit_octostar_utils/api_crafter/parser/entities_parser.py,sha256=zOQoN-p1Gz6ZzxvoX4M1b4Fi3mfmQr5zaNUcp_8gCjw,30016
|
@@ -28,7 +28,7 @@ streamlit_octostar_utils/octostar/context.py,sha256=TpucK48EbeVy4vDqKd9UULEtr1JO
|
|
28
28
|
streamlit_octostar_utils/octostar/permissions.py,sha256=G5nZQLR-k-5_Xeto4nDTb32828Ga-SHm1mvSB9tz-t4,1565
|
29
29
|
streamlit_octostar_utils/ontology/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
30
30
|
streamlit_octostar_utils/ontology/expand_entities.py,sha256=bBt32Dnts3VSzu13QQtPyfYe05IRodD9WfnhNTiBg_w,22749
|
31
|
-
streamlit_octostar_utils/ontology/inheritance.py,sha256=
|
31
|
+
streamlit_octostar_utils/ontology/inheritance.py,sha256=8GA2an1hbHfa6p993tIyfFLrewJHRUIFOw7dmvL8geU,583
|
32
32
|
streamlit_octostar_utils/ontology/validation.py,sha256=0cXxEq8vQ63qxn4WianTioTcsmpsg4jEXVyI4R6x1gE,1051
|
33
33
|
streamlit_octostar_utils/style/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
34
34
|
streamlit_octostar_utils/style/common.py,sha256=TKfjV9-sIoJChGM7Ewg3uPsz5sMmPxFwmc0o3L4D8Qo,1496
|
@@ -36,7 +36,7 @@ streamlit_octostar_utils/threading/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzp
|
|
36
36
|
streamlit_octostar_utils/threading/async_task_manager.py,sha256=q7N6YZwUvIYMzkSHmsJNheNVCv93c03H6Hyg9uH8pvk,4747
|
37
37
|
streamlit_octostar_utils/threading/session_callback_manager.py,sha256=LvZVP4g6tvKtYmI13f2j1sX_7hm61Groqp5xJine9_k,3973
|
38
38
|
streamlit_octostar_utils/threading/session_state_hot_swapper.py,sha256=6eeCQI6A42hp4DmW2NQw2rbeR-k9N8DhfBKQdN_fbLU,811
|
39
|
-
streamlit_octostar_utils-0.2.
|
40
|
-
streamlit_octostar_utils-0.2.
|
41
|
-
streamlit_octostar_utils-0.2.
|
42
|
-
streamlit_octostar_utils-0.2.
|
39
|
+
streamlit_octostar_utils-0.2.12.dist-info/METADATA,sha256=F_7r20YG6UyKEMKxD4yxdm6vs7xbBeW0hakEMAI6kwg,2330
|
40
|
+
streamlit_octostar_utils-0.2.12.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
41
|
+
streamlit_octostar_utils-0.2.12.dist-info/licenses/LICENSE,sha256=dkwVPyV03fPHHtERnF6RnvRXcll__tud9gWca1RcgnQ,1073
|
42
|
+
streamlit_octostar_utils-0.2.12.dist-info/RECORD,,
|
{streamlit_octostar_utils-0.2.11.dist-info → streamlit_octostar_utils-0.2.12.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|