jaseci 1.4.1.9__py3-none-any.whl → 1.4.2__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 jaseci might be problematic. Click here for more details.

jaseci/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1.9
1
+ 1.4.2
@@ -42,17 +42,26 @@ class GlobalApi:
42
42
  @Interface.admin_api()
43
43
  def global_sentinel_set(self, snt: Sentinel = None):
44
44
  """
45
- Set sentinel as globally accessible
45
+ Make a sentinel globally accessible and set it as the global sentinel
46
46
  """
47
47
  snt.make_read_only()
48
48
  snt.propagate_access()
49
49
  self._h.save_glob("GLOB_SENTINEL", snt.jid)
50
50
  return {"response": f"Global sentinel set to '{snt}'!"}
51
51
 
52
+ @Interface.admin_api()
53
+ def global_sentinel_set_access(self, snt: Sentinel = None):
54
+ """
55
+ Make a sentinel globally accessible
56
+ """
57
+ snt.make_read_only()
58
+ snt.propagate_access()
59
+ return {"response": f"Sentinel '{snt}' is now globally accessible."}
60
+
52
61
  @Interface.admin_api()
53
62
  def global_sentinel_unset(self):
54
63
  """
55
- Set sentinel as globally accessible
64
+ Unset a global sentinel
56
65
  """
57
66
  current = self.global_get("GLOB_SENTINEL")["value"]
58
67
  if current:
@@ -81,8 +81,12 @@ class ElasticService(JsOrc.CommonService):
81
81
  under_test = self.config.get("under_test", False)
82
82
  if not under_test:
83
83
  self.configure_elastic()
84
- LOG_QUEUES["core"] = self.add_elastic_log_handler(logger, "core", under_test)
85
- LOG_QUEUES["app"] = self.add_elastic_log_handler(app_logger, "app", under_test)
84
+ LOG_QUEUES["core"] = self.add_elastic_log_handler(
85
+ logger, self.config.get("core_log_index") or "core", under_test
86
+ )
87
+ LOG_QUEUES["app"] = self.add_elastic_log_handler(
88
+ app_logger, self.config.get("app_log_index") or "app", under_test
89
+ )
86
90
 
87
91
  def configure_elastic(self):
88
92
  """
@@ -172,6 +172,8 @@ class JsOrcSettings:
172
172
  "auth": os.getenv("ELASTIC_AUTH"),
173
173
  "common_index": f"{KUBE_NAMESPACE}-common",
174
174
  "activity_index": f"{KUBE_NAMESPACE}-activity",
175
+ "core_log_index": "core",
176
+ "app_log_index": "app",
175
177
  "ilm_policy_name": ELASTIC_ILM_POLICY_NAME,
176
178
  "ilm_policy": ELASTIC_ILM_POLICY,
177
179
  "index_template_name": ELASTIC_INDEX_TEMPLATE_NAME,
jaseci/prim/edge.py CHANGED
@@ -103,8 +103,13 @@ class Edge(Element, Anchored):
103
103
  """
104
104
  Write self through hook to persistent storage
105
105
  """
106
+
106
107
  if self.is_fast():
107
108
  self._persist = False
109
+ if self.from_node_id:
110
+ self.from_node().save()
111
+ if self.to_node_id:
112
+ self.to_node().save()
108
113
  super().save()
109
114
 
110
115
  def destroy(self):
jaseci/prim/node.py CHANGED
@@ -52,16 +52,23 @@ class Node(Element, Anchored):
52
52
  for k in self.fast_edges.keys():
53
53
  for v in self.fast_edges[k]:
54
54
  link_order = [v[0], self.jid] if v[1] == FROM else [self.jid, v[0]]
55
- edge = Edge(
56
- m_id=self._m_id, h=self._h, kind="edge", name=k, auto_save=False
57
- )
58
- edge.from_node_id = link_order[0]
59
- edge.to_node_id = link_order[1]
60
- edge.bidirected = v[1] == BI
61
- edge.jid = v[2] if len(v) > 2 else uuid.uuid4().urn
62
- edge.context = v[3] if len(v) > 3 else {}
63
- edge.save()
64
- self._fast_edge_ids.add_obj(edge)
55
+ edge = self._h.get_obj(self._m_id, v[2])
56
+ if edge:
57
+ v[3] = edge.context
58
+ else:
59
+ edge = Edge(
60
+ m_id=self._m_id, h=self._h, kind="edge", name=k, auto_save=False
61
+ )
62
+ edge.from_node_id = link_order[0]
63
+ edge.to_node_id = link_order[1]
64
+ edge.bidirected = v[1] == BI
65
+ edge.jid = v[2] if len(v) > 2 else uuid.uuid4().urn
66
+ edge.context = v[3] if len(v) > 3 else {}
67
+ # old `edge.save()` might be confusing
68
+ # this line doesn't mean it has to be saved on db
69
+ # it only needs to be available on cache (memory, redis)
70
+ self._h.commit_obj_to_cache(edge, True)
71
+ self._fast_edge_ids.add_obj(edge, bypass=True)
65
72
 
66
73
  def smart_add_edge(self, obj):
67
74
  # make sure fast edges built
@@ -1186,3 +1186,108 @@ struct_types = """
1186
1186
  report [a.basic.apple.apple, a.basic.apple.orange];
1187
1187
  }
1188
1188
  """
1189
+
1190
+
1191
+ simple_graph = """
1192
+ node a1 {has val = 0;}
1193
+ node a2 {has val = 0;}
1194
+ node a3 {has val = 0;}
1195
+ node b1 {has val = 0;}
1196
+ node b2 {has val = 0;}
1197
+ edge e1 {has val = 0;}
1198
+ edge e2 {has val = 0;}
1199
+ edge e3 {has val = 0;}
1200
+
1201
+ walker sample {
1202
+ root {
1203
+ take --> node::a1 else: take spawn here +[e1]+> node::a1;
1204
+ take --> node::b1 else: take spawn here ++> node::b1;
1205
+ }
1206
+
1207
+ a1: take --> node::a2 else {
1208
+ report --> node::a2;
1209
+ report -[e2]-> node::a2;
1210
+ take spawn here +[e2]+> node::a2;
1211
+ }
1212
+ a2: take --> node::a3 else: take spawn here +[e3]+> node::a3;
1213
+ b1: take --> node::b2 else: take spawn here ++> node::b2;
1214
+ }
1215
+
1216
+ walker sample2 {
1217
+ root {
1218
+ take --> node::a1;
1219
+ take --> node::b1;
1220
+ }
1221
+ a1: take --> node::a2;
1222
+ a2: take --> node::a3;
1223
+ a3: here.val = 1;
1224
+ b1: take --> node::b2;
1225
+ b2: here.val = 1;
1226
+ }
1227
+
1228
+ walker sample3 {
1229
+ root {
1230
+ take --> node::a1;
1231
+ take --> node::b1;
1232
+ }
1233
+ a1 {
1234
+ -[e2]->.edge[0].val = 1;
1235
+ take --> node::a2;
1236
+ }
1237
+ a2 {
1238
+ take --> node::a3;
1239
+ here not --> node::a3;
1240
+ }
1241
+ a3: here.val = 2;
1242
+ b1: take --> node::b2;
1243
+ }
1244
+ """
1245
+
1246
+ simple_graph2 = """
1247
+ node a1 {has val = 0;}
1248
+ edge e1 {has val = 0;}
1249
+
1250
+ walker sample {
1251
+ root: report spawn here <+[e1]+ node::a1;
1252
+ }
1253
+
1254
+ walker sample2 {
1255
+ root: report <-[e1]- node::a1.edge[0].val;
1256
+ a1 {
1257
+ --> node::root.edge[0].val = 4;
1258
+ report -[e1]->.edge[0].val;
1259
+ take --> node::root;
1260
+ }
1261
+ }
1262
+
1263
+ walker sample3 {
1264
+ root {
1265
+ report <-[e1]- node::a1.edge[0].val;
1266
+ take <-[e1]- node::a1;
1267
+ }
1268
+
1269
+ a1: report -[e1]->.edge[0].val;
1270
+ }
1271
+
1272
+ walker sample4 {
1273
+ root {
1274
+ <-- node::a1.edge[0].val = 6;
1275
+ report <-[e1]- node::a1.edge[0].val;
1276
+ take <-[e1]- node::a1;
1277
+ }
1278
+ a1: report -[e1]-> node::root.edge[0].val;
1279
+ }
1280
+
1281
+ walker sample5 {
1282
+ root: report <-[e1]-.edge[0].val;
1283
+ a1 {
1284
+ report -[e1]-> node::root.edge[0].val;
1285
+ take -[e1]-> node::root;
1286
+ }
1287
+ }
1288
+
1289
+ walker sample6 {
1290
+ root: <-[e1]- node::a1.edge[0].val = 8;
1291
+ a1: report --> node::root.edge[0].val;
1292
+ }
1293
+ """
jaseci/utils/id_list.py CHANGED
@@ -27,7 +27,9 @@ class IdList(list):
27
27
  def cache_reset(self):
28
28
  self.cached_objects = []
29
29
 
30
- def add_obj(self, obj, push_front=False, allow_dups=False, silent=False):
30
+ def add_obj(
31
+ self, obj, push_front=False, allow_dups=False, silent=False, bypass=False
32
+ ):
31
33
  """Adds a obj obj to Jaseci object"""
32
34
  self.parent_obj.check_hooks_match(obj)
33
35
  if not allow_dups and obj.jid in self:
@@ -39,10 +41,12 @@ class IdList(list):
39
41
  self.insert(0, obj.jid)
40
42
  else:
41
43
  self.append(obj.jid)
42
- if not obj.j_parent:
43
- obj.j_parent = self.parent_obj.jid
44
- self.save(obj)
45
- self.save()
44
+
45
+ if not bypass:
46
+ if not obj.j_parent:
47
+ obj.j_parent = self.parent_obj.jid
48
+ self.save(obj)
49
+ self.save()
46
50
 
47
51
  def add_obj_list(self, obj_list, push_front=False, allow_dups=False, silent=False):
48
52
  self.cache_reset()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaseci
3
- Version: 1.4.1.9
3
+ Version: 1.4.2
4
4
  Home-page: https://github.com/Jaseci-Labs/jaseci
5
5
  Author: Jason Mars
6
6
  Author-email: jason@jaseci.org
@@ -1,4 +1,4 @@
1
- jaseci/VERSION,sha256=XHS3if98ec6lkupR2POyxAWC1yi8cXnM_WKnG5v7Q-Y,8
1
+ jaseci/VERSION,sha256=uZtMfN8jb1m8n2XZY96uyuOxan2th5OcrLkFf3Zk2u4,6
2
2
  jaseci/__init__.py,sha256=tFVuF0i901L-YymidhuSjyE24IWOhIiJA5G18DuAP2g,1246
3
3
  jaseci/cli_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  jaseci/cli_tools/book_tools.py,sha256=4xeNRhKufKJgAaKI5miPTezdBDWeA-iB_H5F5cqyIB8,16103
@@ -48,7 +48,7 @@ jaseci/extens/api/actions_api.py,sha256=Ml2wRROmXofEXWTOXy0PQCxRcjDLkxz163p7Z13z
48
48
  jaseci/extens/api/alias_api.py,sha256=kfO9wxfp_HF5-_1TeIgU5KYAcn-7vZ91GOJiDRUv6gs,5157
49
49
  jaseci/extens/api/architype_api.py,sha256=GozQuyFJYaG-7Ee1JT_62Pc0InCR2KcLD_esrkIdeGM,7237
50
50
  jaseci/extens/api/config_api.py,sha256=OgIkXUKc34HfgetmHtJxKMae8sB2XCl66kI8brtarb0,3581
51
- jaseci/extens/api/global_api.py,sha256=c9wiOaQGlhPUcGYknNkSzAmk67GDlRYYHHUpW_yOBbU,1907
51
+ jaseci/extens/api/global_api.py,sha256=yPPG3LKeifDvbd2fQvjRhL1Bn-gZf4QqRtozb3oCgVk,2226
52
52
  jaseci/extens/api/graph_api.py,sha256=mGuUr22tGys-NypaW0AEZE-vZ6_OzSnqESVxhQrEI60,5074
53
53
  jaseci/extens/api/interface.py,sha256=KnYbClPGe0iTlENdr0LHL8RBuPJGyyuaPspnRvggcXo,9587
54
54
  jaseci/extens/api/jac_api.py,sha256=95w0sh08BHHXv5avMa5xngNo06iipU9Fk08D3TiBHj0,5816
@@ -74,7 +74,7 @@ jaseci/extens/api/tests/test_uncommon.py,sha256=x6JB9tGcD1IIQEOoYuXDO6HCbBji7ynL
74
74
  jaseci/extens/api/tests/test_user_api.py,sha256=4MXXjd48uRbZs0CvEkuVIisCjIM4QrIiARt3mgafXGk,873
75
75
  jaseci/extens/api/tests/test_walker_api.py,sha256=KgWNP5hP4niiMDG0pAoJWPu-thhSarcj6X7MN3BMWJw,12622
76
76
  jaseci/extens/svc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
- jaseci/extens/svc/elastic_svc.py,sha256=48lKlcmohHch7m0rd7hRNT3_XdLVUpBYqtHckKpT-SI,13272
77
+ jaseci/extens/svc/elastic_svc.py,sha256=b34FWYep-4ef7XolF8p5GrSk_Sc-mUSXmFeVlIBHZLo,13389
78
78
  jaseci/extens/svc/kube_svc.py,sha256=o39b_1lrbfUl3yASIkRZStv3X77QudA5hj-ZfYnlcUM,15612
79
79
  jaseci/extens/svc/mail_svc.py,sha256=g7lvUpEDc8mEYIE4cs_Kh3oPp7CAKd437Kgtklo0f8I,5064
80
80
  jaseci/extens/svc/prome_svc.py,sha256=btnYPRI7gFoXzbp0-VJDQn1O4RR8sPlT0iPJpjBkRZ4,12467
@@ -126,7 +126,7 @@ jaseci/jac/tests/test_book.py,sha256=7P5YSSq7HUxNl6KmFh6UM2ZYsBaq-If06KpN0o618YY
126
126
  jaseci/jac/tests/test_lang_14.py,sha256=haw5hvFe4mR1IDHPZGtCvIAMAFLHF0bdg11nl-JP2aQ,1885
127
127
  jaseci/jsorc/__init__.py,sha256=575FXvIbY1S4j1idZn7iqc8z3Gvo1A7FPZNA_1I5Ru4,134
128
128
  jaseci/jsorc/jsorc.py,sha256=moWROfP3MgYLTevBUYBT5llQUYQ8Gj09VHc9TOsb-RI,21601
129
- jaseci/jsorc/jsorc_settings.py,sha256=3UIsgFHf8clp4NG0guO4sT5TnbmeNKCgQp-47xa8Mcg,8849
129
+ jaseci/jsorc/jsorc_settings.py,sha256=eUYEt4CNoPfvHMSYqUtyggQi6snSX7kwwW0ECnOEp_0,8915
130
130
  jaseci/jsorc/jsorc_utils.py,sha256=hie_5ttXKM_MqBumFbRFzszAAzdksIUuQbNLpLvOFX0,8945
131
131
  jaseci/jsorc/live_actions.py,sha256=_hHPfjzu4fE1uA7oP6aOs-5XT0_2KV5mFf7fWbJq69s,12302
132
132
  jaseci/jsorc/memory.py,sha256=b-jX452YN3-EqrKXTPC676xL9BoGNpLAgu9h3OJxeV0,8254
@@ -143,11 +143,11 @@ jaseci/jsorc/tests/test_jsorc.py,sha256=HAwDmI7NuuUJrFFdADYjpCCnr58cd9qPy1AZQ-ws
143
143
  jaseci/prim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
144
  jaseci/prim/ability.py,sha256=XkHpKCsCjZ9Je7oiL0X_Mkbz_FSiVBxGaAVLZv7LCXI,3405
145
145
  jaseci/prim/architype.py,sha256=mscTCsXTKh4ZBGyQTGHxEbQl1FFRJs3eoHs7koxLhm4,2706
146
- jaseci/prim/edge.py,sha256=BghEIhy7CNQ5_e_UzpkpClSpDBEvJTJwDit07Tkk1sI,5024
146
+ jaseci/prim/edge.py,sha256=GzKLZVio28sCF65zfDzFDHyjDPlfcTbQA5L3RkItcR0,5169
147
147
  jaseci/prim/element.py,sha256=XFGw0vVFdIe-KkBMILYWI-KkaltASdo6nm9NHLPYfSo,7669
148
148
  jaseci/prim/graph.py,sha256=uZZLyq9jmQilCrAMUKpSwDXqrhVR8JGlIcu8bmPbCjY,596
149
149
  jaseci/prim/master.py,sha256=WCfMqWJ9D1V_6Zny96it_6FcDcia3iUZp9qRwYa2Vs0,1835
150
- jaseci/prim/node.py,sha256=trjLehUQRf6Mwjz986fDe4z99JkOxuexTknUiFbMBvc,17712
150
+ jaseci/prim/node.py,sha256=TtDRCBy8azHKclwpdmpDMcQUZi0XdtGn3A5iv4r8Q8o,18139
151
151
  jaseci/prim/obj_mixins.py,sha256=BNvNzUGjWKtJ2jJSizPdvELW-TEupsueGA7VMr-tU8A,7286
152
152
  jaseci/prim/sentinel.py,sha256=ERWM-7p9xVRj1oAvQlv6gvMeudS0qqlhRi_06VD7uMs,9531
153
153
  jaseci/prim/super_master.py,sha256=KHSD1YoF1OKWw3ob8qdS9Amxf38N0FpYfCkT1mk_DDQ,852
@@ -155,7 +155,7 @@ jaseci/prim/walker.py,sha256=gUCOiqdM6YaZpoSMUPErpb4UwDrQoa-DhqfwEVqACSw,8884
155
155
  jaseci/svc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
156
  jaseci/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
157
  jaseci/tests/infer.py,sha256=3TAwXO1W5s4yLDV5p_Izxbp5PvyQYR2oaMcB_aYza4c,1006
158
- jaseci/tests/jac_test_code.py,sha256=0WrmoCECv0rHI-L2hOPvZCprAOT9GqmGhr9H2d_LJSs,25823
158
+ jaseci/tests/jac_test_code.py,sha256=d8WycjXqmqQJr07abJBIinuyTTDwXdYZxUU6qkhfrBY,27903
159
159
  jaseci/tests/jac_test_progs.py,sha256=U7RwFdZUsEpZMdv-PUhBZ8CuRmTusRvKmNKNLRO_mfA,14672
160
160
  jaseci/tests/test_core.py,sha256=fYoIF-xQizO8qrMnFpwhzMgScJAx5XTOL7SdvCx7do4,5888
161
161
  jaseci/tests/test_jac.py,sha256=bE6FLhLV0-TnxLlS7HdPxe65wMj65Pa_qGLySpuVIJA,32750
@@ -166,7 +166,7 @@ jaseci/tests/test_stripe.py,sha256=bXq4m7AIRquWu7ZCzzp4Qz99NccuZTt_Tjjg-Kx1isE,8
166
166
  jaseci/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
167
  jaseci/utils/file_handler.py,sha256=b1_zCVO37h1eKjaa_P9jKkx0lwJfrsWKRGkv68lYpY8,4797
168
168
  jaseci/utils/gprof2dot.py,sha256=NwoCm318NFS169fvJhfltsIINxzpd6bS7_9b1-Fy4Xg,119142
169
- jaseci/utils/id_list.py,sha256=L1uzwBrLRxnw3EaapOsEMA7QCsbY50RnK0nFTu2ruWo,5328
169
+ jaseci/utils/id_list.py,sha256=vknSJi-xtIMPW8O3SjJb7l_Jg3Fw4kMjCAm6tS9KZ9s,5400
170
170
  jaseci/utils/json_handler.py,sha256=-MmExFTpbr5hlS9i_0DAUZK-rgWI2wpDAA4rI3idv74,2234
171
171
  jaseci/utils/log_utils.py,sha256=U46KspmCbX6S7YzEk1LB20iB4G1DPHfpV5RFim04Mbg,1629
172
172
  jaseci/utils/test_core.py,sha256=DG0mW2GRc2l0M1A1-vCgTUFnZh8ip_0-h7eOfKMxlXQ,1549
@@ -175,9 +175,9 @@ jaseci/utils/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
175
175
  jaseci/utils/actions/actions_manager.py,sha256=sKfWk9zRpDpkLo3-mKpVMKrqx7kpRG7hRi5tfDTcqb8,8527
176
176
  jaseci/utils/actions/actions_optimizer.py,sha256=ddj6zF6pfcYD3OeLiOBTeDU07764-bLy7RXn7c71JrI,21564
177
177
  jaseci/utils/actions/actions_state.py,sha256=5p080-DtDXS9QUd2FwkrtN6-7LBqT2tmJDOKVKjDEbU,2963
178
- jaseci-1.4.1.9.dist-info/LICENSE,sha256=2b_qOOd7ak6x49HwOzCAmRLSPJehiBJdqj9HDX1Jp7U,1072
179
- jaseci-1.4.1.9.dist-info/METADATA,sha256=QfrZRsD8OyTKi3lqhQKIw2-kQVjO1Hr7Xj0BaNuL7uo,1104
180
- jaseci-1.4.1.9.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
181
- jaseci-1.4.1.9.dist-info/entry_points.txt,sha256=nryZyKQLUJzlTOcA9knRGoXHGmNUCQxvvuDIEj5ePyg,88
182
- jaseci-1.4.1.9.dist-info/top_level.txt,sha256=0WZh7RF_ruiaZHQSi8IWOiLRUvKKDlhcnLe-by6EyFc,7
183
- jaseci-1.4.1.9.dist-info/RECORD,,
178
+ jaseci-1.4.2.dist-info/LICENSE,sha256=2b_qOOd7ak6x49HwOzCAmRLSPJehiBJdqj9HDX1Jp7U,1072
179
+ jaseci-1.4.2.dist-info/METADATA,sha256=hdA3vhSDn6vQtv778-nZv_Siruc_xieemJWESSkbA44,1102
180
+ jaseci-1.4.2.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
181
+ jaseci-1.4.2.dist-info/entry_points.txt,sha256=nryZyKQLUJzlTOcA9knRGoXHGmNUCQxvvuDIEj5ePyg,88
182
+ jaseci-1.4.2.dist-info/top_level.txt,sha256=0WZh7RF_ruiaZHQSi8IWOiLRUvKKDlhcnLe-by6EyFc,7
183
+ jaseci-1.4.2.dist-info/RECORD,,