ratio1 3.4.119__py3-none-any.whl → 3.4.121__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.
ratio1/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "3.4.119"
1
+ __VER__ = "3.4.121"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
ratio1/bc/base.py CHANGED
@@ -1444,6 +1444,7 @@ class BaseBlockEngine(
1444
1444
  network=None,
1445
1445
  return_full_data=False,
1446
1446
  debug_data=False,
1447
+ request_timeout=(3.05, 27),
1447
1448
  **kwargs
1448
1449
  ):
1449
1450
  """
@@ -1455,6 +1456,7 @@ class BaseBlockEngine(
1455
1456
  debug
1456
1457
  max_tries
1457
1458
  network
1459
+ request_timeout
1458
1460
  kwargs
1459
1461
 
1460
1462
  Returns
@@ -1533,8 +1535,8 @@ class BaseBlockEngine(
1533
1535
  self.sign(to_send)
1534
1536
  json_to_send = {'body' : to_send}
1535
1537
  if debug:
1536
- self.P(f"Sending to dAuth URL: {url}\n{json.dumps(json_to_send, indent=2)}")
1537
- response = requests.post(url, json=json_to_send)
1538
+ self.P(f"Requesting dAuth (timeout={request_timeout}): {url}\n{json.dumps(json_to_send, indent=2)}")
1539
+ response = requests.post(url, json=json_to_send, timeout=request_timeout)
1538
1540
  if debug:
1539
1541
  self.P(f"Received response (status {response.status_code}).")
1540
1542
  if response.status_code == 200:
@@ -10,7 +10,7 @@ and it is used by cli.py
10
10
  """
11
11
 
12
12
  from ratio1.cli.nodes import (
13
- get_nodes, get_supervisors,
13
+ get_nodes, get_supervisors, get_comms,
14
14
  restart_node, shutdown_node,
15
15
  get_apps, inspect_node
16
16
  )
@@ -47,6 +47,10 @@ CLI_COMMANDS = {
47
47
  "--wide" : "Display all available information (flag)",
48
48
  }
49
49
  },
50
+ "comms": {
51
+ "func": get_comms,
52
+ "description": "Get comm relay summary for seed ownership and connected peers.",
53
+ },
50
54
  "eth" : {
51
55
  "func": get_eth_addr,
52
56
  "description": "Get the ETH address given a node address",
ratio1/cli/nodes.py CHANGED
@@ -137,6 +137,66 @@ def get_supervisors(args):
137
137
  return
138
138
 
139
139
 
140
+ def get_comms(args):
141
+ """
142
+ This function is used to get the comm relay summary.
143
+ """
144
+ if args.verbose:
145
+ log_with_color("Getting comm relay summary...", color='b')
146
+
147
+ res = _get_netstats(
148
+ silent=not args.verbose,
149
+ online_only=False,
150
+ allowed_only=False,
151
+ return_session=True,
152
+ )
153
+ df, supervisor, super_alias, nr_supers, elapsed, sess = res
154
+
155
+ if supervisor == "ERROR":
156
+ log_with_color(f"No supervisors or no comms available in {elapsed:.1f}s. Please check your settings.", color='r')
157
+ return
158
+
159
+ if df is None or df.empty:
160
+ log_with_color("No nodes found in the network report.", color='r')
161
+ return
162
+
163
+ required_cols = ["Alias", "Comm Relay"]
164
+ missing_cols = [c for c in required_cols if c not in df.columns]
165
+ if missing_cols:
166
+ log_with_color(f"Missing columns in network report: {missing_cols}", color='r')
167
+ return
168
+
169
+ df_relays = df[required_cols].copy()
170
+ df_relays = df_relays[df_relays["Comm Relay"].notna()]
171
+
172
+ # Map each comm relay to its seed alias (seed names are r1s-XY).
173
+ seed_mask = df_relays["Alias"].str.match(r"^r1s-\d+$", case=False, na=False)
174
+ seed_alias_by_relay = {}
175
+ for _, row in df_relays[seed_mask].iterrows():
176
+ relay = row["Comm Relay"]
177
+ if relay not in seed_alias_by_relay:
178
+ seed_alias_by_relay[relay] = row["Alias"]
179
+
180
+ summary = df_relays.groupby("Comm Relay").size().reset_index(name="Connected Peers")
181
+ summary["Seed Alias"] = summary["Comm Relay"].map(seed_alias_by_relay)
182
+ summary = summary.rename(columns={"Comm Relay": "Comm relay"})
183
+ summary = summary[["Comm relay", "Seed Alias", "Connected Peers"]]
184
+
185
+ import pandas as pd
186
+ pd.set_option('display.float_format', '{:.4f}'.format)
187
+
188
+ network = sess.bc_engine.evm_network
189
+ addr = sess.bc_engine.address
190
+ log_with_color(f"Ratio1 client v{version}: {addr} \n", color='b')
191
+ log_with_color(
192
+ "Comm relays on '{}' reported by <{}> '{}' in {:.1f}s ({} supervisors seen):".format(
193
+ network, supervisor, super_alias, elapsed, nr_supers),
194
+ color='b'
195
+ )
196
+ log_with_color(f"{summary}\n")
197
+ return summary
198
+
199
+
140
200
  def get_apps(args):
141
201
  """
142
202
  Shows the apps running on a given node, if the client is allowed on that node.
@@ -421,4 +481,4 @@ def _display_node_stats_for_hb(node_hb, wide=False):
421
481
 
422
482
  log_with_color(f"\n", color='w') # Add final newline for spacing
423
483
 
424
- return
484
+ return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ratio1
3
- Version: 3.4.119
3
+ Version: 3.4.121
4
4
  Summary: `ratio1` or Ration1 SDK is the Python SDK required for client app development for the Ratio1 ecosystem
5
5
  Project-URL: Homepage, https://github.com/Ratio1/ratio1_sdk
6
6
  Project-URL: Bug Tracker, https://github.com/Ratio1/ratio1_sdk/issues
@@ -1,5 +1,5 @@
1
1
  ratio1/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- ratio1/_ver.py,sha256=mCULvfH11my6ewL6BfupfyAgK5F_s3ttSDNsnjKEuWk,332
2
+ ratio1/_ver.py,sha256=k9KxaN-ruv5M8R_WdANzD9HtQSUdvJr_P5YPw1u-lvQ,332
3
3
  ratio1/base_decentra_object.py,sha256=iXvAAf6wPnGWzeeiRfwLojVoan-m1e_VsyPzjUQuENo,4492
4
4
  ratio1/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  ratio1/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
@@ -14,7 +14,7 @@ ratio1/base/webapp_pipeline.py,sha256=H83EjkmyljetdHZ18V5R8OU3wXoWi_EpV0AAhQ4AM6
14
14
  ratio1/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
15
15
  ratio1/base/payload/payload.py,sha256=MoCeL6iZzl1an-4eqRpLW0iz6Yk3OvlBrymcmhWeecM,2689
16
16
  ratio1/bc/__init__.py,sha256=BI5pcqHdhwnMdbWTYDLW1cVP_844VtLra-lz7xprgsk,171
17
- ratio1/bc/base.py,sha256=fGw_16YIKGOqsAQsoQ0R3vClFEelfu42Bb6nCEcQ36c,46160
17
+ ratio1/bc/base.py,sha256=iNOUPK-HIQd9UCuQaRdN4objMpV5UDBQlZR7LF6vvfk,46261
18
18
  ratio1/bc/chain.py,sha256=HCTQGnmuKqTvUo95OKdg8rL2jhKfSMwrich2e_7Nyms,2336
19
19
  ratio1/bc/ec.py,sha256=FwlkWmJvQ9aHuf_BZX1CWSUAxw6OZ9jBparLIWcs_e4,18933
20
20
  ratio1/bc/evm.py,sha256=iMLdm_rtQFqmt44zTE_UA0OKSTmuH7sCSI2iKvFI1_k,52013
@@ -31,8 +31,8 @@ ratio1/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde
31
31
  ratio1/certs/s624dbd4.ala.us-east-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
32
32
  ratio1/cli/README.md,sha256=YsT23YcZBRyTKReNZPxD762YqstSWKWz4iZe_UJELPc,73
33
33
  ratio1/cli/cli.py,sha256=D8UCtdTQKi1IqB_PAi3k2FfaM-rnfxmlrOzM4OJBOsA,4352
34
- ratio1/cli/cli_commands.py,sha256=NlcBNAiSQBGPk54Y5BS7Je0XPdnGPA1bYpcgX6d2Pxg,6703
35
- ratio1/cli/nodes.py,sha256=VkqjKef8ByWNyO7zr3nBEWUZrAlaDQ_9yMgChQPschE,13942
34
+ ratio1/cli/cli_commands.py,sha256=2JD3W89yiRTccRmzz2oZTcUpZvhn5Ip5FAO9do4jJTk,6868
35
+ ratio1/cli/nodes.py,sha256=nsuqDVWZlbHKBz3O7k5l2EVd5UXKvaYWsL5itaBMY74,15991
36
36
  ratio1/cli/oracles.py,sha256=9SsIYa2Go37CKecJ_poFLdIcMVZlEkc4eV0QCevWNb4,15076
37
37
  ratio1/cli/package_update.py,sha256=uRMPW5XV3fBdB_eZfoQDA1SKnJzTJvyfpRJA6T3ZZlQ,4000
38
38
  ratio1/code_cheker/__init__.py,sha256=pwkdeZGVL16ZA4Qf2mRahEhoOvKhL7FyuQbMFLr1E5M,33
@@ -109,8 +109,8 @@ ratio1/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,10
109
109
  ratio1/utils/config.py,sha256=Elfkl7W4aDMvB5WZLiYlPXrecBncgTxb4hcKhQedMzI,10111
110
110
  ratio1/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
111
111
  ratio1/utils/oracle_sync/oracle_tester.py,sha256=aJOPcZhtbw1XPqsFG4qYpfv2Taj5-qRXbwJzrPyeXDE,27465
112
- ratio1-3.4.119.dist-info/METADATA,sha256=4o6ceJwHd3UcJ7FlpKjJ1k1Zm4qA0jWNhLmCYGhvxWg,12256
113
- ratio1-3.4.119.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
114
- ratio1-3.4.119.dist-info/entry_points.txt,sha256=DR_olREzU1egwmgek3s4GfQslBi-KR7lXsd4ap0TFxE,46
115
- ratio1-3.4.119.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
116
- ratio1-3.4.119.dist-info/RECORD,,
112
+ ratio1-3.4.121.dist-info/METADATA,sha256=_lNzV3ujov5sKLQQ55SRsWQ-xMmI1Gftxh_nmG_vYnQ,12256
113
+ ratio1-3.4.121.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
114
+ ratio1-3.4.121.dist-info/entry_points.txt,sha256=DR_olREzU1egwmgek3s4GfQslBi-KR7lXsd4ap0TFxE,46
115
+ ratio1-3.4.121.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
116
+ ratio1-3.4.121.dist-info/RECORD,,