wnm 0.0.8__py3-none-any.whl → 0.0.9__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 wnm might be problematic. Click here for more details.
- wnm/__init__.py +1 -1
- wnm/__main__.py +647 -445
- wnm/models.py +151 -63
- {wnm-0.0.8.dist-info → wnm-0.0.9.dist-info}/METADATA +4 -2
- wnm-0.0.9.dist-info/RECORD +9 -0
- wnm-0.0.8.dist-info/RECORD +0 -9
- {wnm-0.0.8.dist-info → wnm-0.0.9.dist-info}/WHEEL +0 -0
- {wnm-0.0.8.dist-info → wnm-0.0.9.dist-info}/entry_points.txt +0 -0
- {wnm-0.0.8.dist-info → wnm-0.0.9.dist-info}/top_level.txt +0 -0
wnm/models.py
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import json_fix
|
|
2
|
-
|
|
3
1
|
# Turn a class into a storable object with ORM
|
|
4
2
|
from typing import Optional
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from sqlalchemy
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
|
|
4
|
+
import json_fix
|
|
5
|
+
from sqlalchemy import (
|
|
6
|
+
Float,
|
|
7
|
+
Integer,
|
|
8
|
+
Unicode,
|
|
9
|
+
UnicodeText,
|
|
10
|
+
create_engine,
|
|
11
|
+
insert,
|
|
12
|
+
select,
|
|
13
|
+
update,
|
|
14
|
+
)
|
|
15
|
+
from sqlalchemy.orm import (
|
|
16
|
+
DeclarativeBase,
|
|
17
|
+
Mapped,
|
|
18
|
+
mapped_column,
|
|
19
|
+
scoped_session,
|
|
20
|
+
sessionmaker,
|
|
21
|
+
)
|
|
22
|
+
|
|
10
23
|
|
|
11
24
|
# create a Base class bound to sqlalchemy
|
|
12
25
|
class Base(DeclarativeBase):
|
|
13
26
|
pass
|
|
14
27
|
|
|
28
|
+
|
|
15
29
|
# Extend the Base class to create our Host info
|
|
16
30
|
class Machine(Base):
|
|
17
|
-
__tablename__ =
|
|
31
|
+
__tablename__ = "machine"
|
|
18
32
|
# No schema in sqlite3
|
|
19
33
|
# __table_args__ = {"schema": "colony"}
|
|
20
34
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
@@ -46,15 +60,36 @@ class Machine(Base):
|
|
|
46
60
|
NetIOWriteRemove: Mapped[float] = mapped_column(Float)
|
|
47
61
|
LastStoppedAt: Mapped[int] = mapped_column(Integer)
|
|
48
62
|
|
|
49
|
-
def __init__(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
def __init__(
|
|
64
|
+
self,
|
|
65
|
+
CpuCount,
|
|
66
|
+
NodeCap,
|
|
67
|
+
CpuLessThan,
|
|
68
|
+
CpuRemove,
|
|
69
|
+
MemLessThan,
|
|
70
|
+
MemRemove,
|
|
71
|
+
HDLessThan,
|
|
72
|
+
HDRemove,
|
|
73
|
+
DelayStart,
|
|
74
|
+
DelayUpgrade,
|
|
75
|
+
DelayRemove,
|
|
76
|
+
NodeStorage,
|
|
77
|
+
RewardsAddress,
|
|
78
|
+
DonateAddress,
|
|
79
|
+
MaxLoadAverageAllowed,
|
|
80
|
+
DesiredLoadAverage,
|
|
81
|
+
PortStart,
|
|
82
|
+
HDIOReadLessThan,
|
|
83
|
+
HDIOReadRemove,
|
|
84
|
+
HDIOWriteLessThan,
|
|
85
|
+
HDIOWriteRemove,
|
|
86
|
+
NetIOReadLessThan,
|
|
87
|
+
NetIOReadRemove,
|
|
88
|
+
NetIOWriteLessThan,
|
|
89
|
+
NetIOWriteRemove,
|
|
90
|
+
LastStoppedAt,
|
|
91
|
+
):
|
|
92
|
+
|
|
58
93
|
self.CpuCount = CpuCount
|
|
59
94
|
self.NodeCap = NodeCap
|
|
60
95
|
self.CpuLessThan = CpuLessThan
|
|
@@ -83,37 +118,56 @@ class Machine(Base):
|
|
|
83
118
|
self.LastStoppedAt = LastStoppedAt
|
|
84
119
|
|
|
85
120
|
def __repr__(self):
|
|
86
|
-
return
|
|
87
|
-
f
|
|
88
|
-
f
|
|
89
|
-
f
|
|
90
|
-
f
|
|
91
|
-
f',{self.
|
|
92
|
-
f
|
|
93
|
-
f
|
|
94
|
-
f
|
|
95
|
-
f
|
|
96
|
-
f
|
|
97
|
-
|
|
121
|
+
return (
|
|
122
|
+
f"Machine({self.CpuCount},{self.NodeCap},{self.CpuLessThan},{self.CpuRemove}"
|
|
123
|
+
+ f",{self.MemLessThan},{self.MemRemove},{self.HDLessThan}"
|
|
124
|
+
+ f",{self.HDRemove},{self.DelayStart},{self.DelayUpgrade}"
|
|
125
|
+
+ f",{self.DelayRemove}"
|
|
126
|
+
+ f',"{self.NodeStorage}","{self.RewardsAddress}","{self.DonateAddress}"'
|
|
127
|
+
+ f",{self.MaxLoadAverageAllowed},{self.DesiredLoadAverage}"
|
|
128
|
+
+ f",{self.PortStart},{self.HDIOReadLessThan},{self.HDIOReadRemove}"
|
|
129
|
+
+ f",{self.HDIOWriteLessThan},{self.HDIOWriteRemove}"
|
|
130
|
+
+ f",{self.NetIOReadLessThan},{self.NetIOReadRemove}"
|
|
131
|
+
+ f",{self.NetIOWriteLessThan},{self.NetIOWriteRemove}"
|
|
132
|
+
+ f",{self.LastStoppedAt})"
|
|
133
|
+
)
|
|
134
|
+
|
|
98
135
|
def __json__(self):
|
|
99
|
-
return {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
136
|
+
return {
|
|
137
|
+
"CpuCount": self.CpuCount,
|
|
138
|
+
"NodeCap": self.NodeCap,
|
|
139
|
+
"CpuLessThan": self.CpuLessThan,
|
|
140
|
+
"CpuRemove": self.CpuRemove,
|
|
141
|
+
"MemLessThan": self.MemLessThan,
|
|
142
|
+
"MemRemove": self.MemRemove,
|
|
143
|
+
"HDLessThan": self.HDLessThan,
|
|
144
|
+
"HDRemove": self.HDRemove,
|
|
145
|
+
"DelayStart": self.DelayStart,
|
|
146
|
+
"DelayUpgrade": self.DelayUpgrade,
|
|
147
|
+
"DelayRemove": self.DelayRemove,
|
|
148
|
+
"NodeStorage": f"{self.NodeStorage}",
|
|
149
|
+
"RewardsAddress": f"{self.RewardsAddress}",
|
|
150
|
+
"DonateAddress": f"{self.DonateAddress}",
|
|
151
|
+
"MaxLoadAverageAllowed": self.MaxLoadAverageAllowed,
|
|
152
|
+
"DesiredLoadAverage": self.DesiredLoadAverage,
|
|
153
|
+
"PortStart": self.PortStart,
|
|
154
|
+
"HDIOReadLessThan": self.HDIOReadLessThan,
|
|
155
|
+
"HDIOReadRemove": self.HDIOReadRemove,
|
|
156
|
+
"HDIOWriteLessThan": self.HDIOWriteLessThan,
|
|
157
|
+
"HDIOWriteRemove": self.HDIOWriteRemove,
|
|
158
|
+
"NetIOReadLessThan": self.NetIOReadLessThan,
|
|
159
|
+
"NetIOReadRemove": self.NetIOReadRemove,
|
|
160
|
+
"NetIOWriteLessThan": self.NetIOWriteLessThan,
|
|
161
|
+
"NetIOWriteRemove": self.NetIOWriteRemove,
|
|
162
|
+
"LastStoppedAt": self.LastStoppedAt,
|
|
163
|
+
}
|
|
164
|
+
|
|
110
165
|
|
|
111
|
-
|
|
112
166
|
# Extend the Base class to create our Node info
|
|
113
167
|
class Node(Base):
|
|
114
|
-
__tablename__ =
|
|
168
|
+
__tablename__ = "node"
|
|
115
169
|
# No schema in sqlite3
|
|
116
|
-
#__table_args__ = {"schema": "colony"}
|
|
170
|
+
# __table_args__ = {"schema": "colony"}
|
|
117
171
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
118
172
|
# Maps to antnode-{nodename}
|
|
119
173
|
nodename: Mapped[str] = mapped_column(Unicode(10))
|
|
@@ -134,15 +188,15 @@ class Node(Base):
|
|
|
134
188
|
# Network to use ( Live is evm-arbitrum-one )
|
|
135
189
|
network: Mapped[str] = mapped_column(UnicodeText)
|
|
136
190
|
# Reward address
|
|
137
|
-
wallet: Mapped[Optional[str]] = mapped_column(Unicode(42),index=True)
|
|
191
|
+
wallet: Mapped[Optional[str]] = mapped_column(Unicode(42), index=True)
|
|
138
192
|
# Reported peer_id
|
|
139
193
|
peer_id: Mapped[Optional[str]] = mapped_column(Unicode(52))
|
|
140
194
|
# Node's last probed status
|
|
141
|
-
status: Mapped[str] = mapped_column(Unicode(32),index=True)
|
|
195
|
+
status: Mapped[str] = mapped_column(Unicode(32), index=True)
|
|
142
196
|
# Timestamp of last update
|
|
143
|
-
timestamp: Mapped[int] = mapped_column(Integer,index=True)
|
|
197
|
+
timestamp: Mapped[int] = mapped_column(Integer, index=True)
|
|
144
198
|
# Number of node records stored as reported by node
|
|
145
|
-
records: Mapped[int] = mapped_column(Integer,index=True)
|
|
199
|
+
records: Mapped[int] = mapped_column(Integer, index=True)
|
|
146
200
|
# Node reported uptime
|
|
147
201
|
uptime: Mapped[int] = mapped_column(Integer)
|
|
148
202
|
# Number of shuns
|
|
@@ -152,10 +206,28 @@ class Node(Base):
|
|
|
152
206
|
# Host ip/name for data and metrics ports
|
|
153
207
|
host: Mapped[Optional[str]] = mapped_column(UnicodeText)
|
|
154
208
|
|
|
155
|
-
def __init__(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
209
|
+
def __init__(
|
|
210
|
+
self,
|
|
211
|
+
id,
|
|
212
|
+
nodename,
|
|
213
|
+
service,
|
|
214
|
+
user,
|
|
215
|
+
binary,
|
|
216
|
+
version,
|
|
217
|
+
root_dir,
|
|
218
|
+
port,
|
|
219
|
+
metrics_port,
|
|
220
|
+
network,
|
|
221
|
+
wallet,
|
|
222
|
+
peer_id,
|
|
223
|
+
status,
|
|
224
|
+
timestamp,
|
|
225
|
+
records,
|
|
226
|
+
uptime,
|
|
227
|
+
shunned,
|
|
228
|
+
age,
|
|
229
|
+
host,
|
|
230
|
+
):
|
|
159
231
|
self.id = id
|
|
160
232
|
self.nodename = nodename
|
|
161
233
|
self.service = service
|
|
@@ -177,16 +249,32 @@ class Node(Base):
|
|
|
177
249
|
self.host = host
|
|
178
250
|
|
|
179
251
|
def __repr__(self):
|
|
180
|
-
return
|
|
181
|
-
f',"{self.
|
|
182
|
-
f',"{self.
|
|
183
|
-
f',{self.
|
|
184
|
-
|
|
252
|
+
return (
|
|
253
|
+
f'Node({self.id},"{self.nodename}","{self.service}","{self.user},"{self.binary}"'
|
|
254
|
+
+ f',"{self.version}","{self.root_dir}",{self.port},{self.metrics_port}'
|
|
255
|
+
+ f',"{self.network}","{self.wallet}","{self.peer_id}","{self.status}",{self.timestamp}'
|
|
256
|
+
+ f',{self.records},{self.uptime},{self.shunned},{self.age},"{self.host}")'
|
|
257
|
+
)
|
|
258
|
+
|
|
185
259
|
def __json__(self):
|
|
186
|
-
return {
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
260
|
+
return {
|
|
261
|
+
"id": self.id,
|
|
262
|
+
"nodename": f"{self.nodename}",
|
|
263
|
+
"service": f"{self.service}",
|
|
264
|
+
"user": f"{self.user}",
|
|
265
|
+
"binary": f"{self.binary}",
|
|
266
|
+
"version": f"{self.version}",
|
|
267
|
+
"root_dir": f"{self.root_dir}",
|
|
268
|
+
"port": self.port,
|
|
269
|
+
"metrics_port": self.metrics_port,
|
|
270
|
+
"network": f"{self.network}",
|
|
271
|
+
"wallet": f"{self.wallet}",
|
|
272
|
+
"peer_id": f"{self.peer_id}",
|
|
273
|
+
"status": f"{self.status}",
|
|
274
|
+
"timestamp": self.timestamp,
|
|
275
|
+
"records": self.records,
|
|
276
|
+
"uptime": self.uptime,
|
|
277
|
+
"shunned": self.shunned,
|
|
278
|
+
"age": self.age,
|
|
279
|
+
"host": f"{self.host}",
|
|
280
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wnm
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Manager for Autonomi nodes
|
|
5
5
|
Author-email: Troy Johnson <troy@weave.sh>
|
|
6
6
|
License: GPL-3.0
|
|
7
|
+
Project-URL: Repository, https://github.com/iweave/weave-node-manager.git
|
|
8
|
+
Project-URL: Issues, https://github.com/iweave/weave-node-manager/issues
|
|
7
9
|
Keywords: Autonomi,antnode,weave,xd7
|
|
8
10
|
Classifier: Development Status :: 3 - Alpha
|
|
9
11
|
Classifier: Environment :: Console
|
|
@@ -70,7 +72,7 @@ Weave Node Manager (wnm) is a Python application designed to manage nodes for de
|
|
|
70
72
|
```
|
|
71
73
|
echo <<EOF
|
|
72
74
|
SHELL=/bin/bash
|
|
73
|
-
PATH=/home/ubuntu/.local/bin:/home/ubuntu/wnm
|
|
75
|
+
PATH=/home/ubuntu/.local/bin:/home/ubuntu/wnm/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
74
76
|
*/1 * * * * ubuntu cd /home/ubuntu/wnm && wnm > /home/ubuntu/wnm/cron.out 2>&1
|
|
75
77
|
EOF
|
|
76
78
|
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
wnm/__init__.py,sha256=wnR-RpRGfmQSlcHdue7DLD-ZZ_i7JqSQgh-EpgYdyKk,91
|
|
2
|
+
wnm/__main__.py,sha256=MhRLjRv3VrwVlbtUmhBpfcLgyxe0oERexVIKNVchD3I,44447
|
|
3
|
+
wnm/config.py,sha256=nMJlzxZX7NA0iI_QAuJDE0uI3V_ROjP5v99wdKDfuDs,47
|
|
4
|
+
wnm/models.py,sha256=4FRgDcUxT9Hk4VT1FL2kxhep5G3vkxaU0v9LftylDkA,9997
|
|
5
|
+
wnm-0.0.9.dist-info/METADATA,sha256=hBb-_t8RJsCHg713Owb1I-M6kfybPb_nzLgzwd85Zdc,3119
|
|
6
|
+
wnm-0.0.9.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
|
7
|
+
wnm-0.0.9.dist-info/entry_points.txt,sha256=jfoemjoLVPeeiBMHKqAExrHQ4Rhf9IXxL4JCnS7ZYFo,42
|
|
8
|
+
wnm-0.0.9.dist-info/top_level.txt,sha256=E6dTE5k6efMEB9LaJAZSBu8zzs__l4R55t0-F-LwufI,4
|
|
9
|
+
wnm-0.0.9.dist-info/RECORD,,
|
wnm-0.0.8.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
wnm/__init__.py,sha256=Ha9Nzes9yJ5jMwfAR7DygPzcSKP8jIwQp9GQAVRE8OU,91
|
|
2
|
-
wnm/__main__.py,sha256=779OKyej7fBte3cSUCnqQx3R05iSfjaU2XvOyPYXWI4,42957
|
|
3
|
-
wnm/config.py,sha256=nMJlzxZX7NA0iI_QAuJDE0uI3V_ROjP5v99wdKDfuDs,47
|
|
4
|
-
wnm/models.py,sha256=7lhZkUfFlnDgeEVRngQVuFnzSbJPwbytLMCynAo1j28,9416
|
|
5
|
-
wnm-0.0.8.dist-info/METADATA,sha256=Hvlc06scFyASbDVL-L4NxPyCjNtKWSyyCDAyY8Hn8P0,2972
|
|
6
|
-
wnm-0.0.8.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
|
7
|
-
wnm-0.0.8.dist-info/entry_points.txt,sha256=jfoemjoLVPeeiBMHKqAExrHQ4Rhf9IXxL4JCnS7ZYFo,42
|
|
8
|
-
wnm-0.0.8.dist-info/top_level.txt,sha256=E6dTE5k6efMEB9LaJAZSBu8zzs__l4R55t0-F-LwufI,4
|
|
9
|
-
wnm-0.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|