serverwatcher 3.6.4__tar.gz → 3.7.1__tar.gz
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.
- {serverwatcher-3.6.4/src/serverwatcher.egg-info → serverwatcher-3.7.1}/PKG-INFO +1 -1
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/pyproject.toml +1 -1
- serverwatcher-3.7.1/src/serverwatcher/config/messages.py +53 -0
- serverwatcher-3.7.1/src/serverwatcher/defaultconfigs/messages.yaml +49 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/watcher.py +24 -6
- {serverwatcher-3.6.4 → serverwatcher-3.7.1/src/serverwatcher.egg-info}/PKG-INFO +1 -1
- serverwatcher-3.6.4/src/serverwatcher/config/messages.py +0 -30
- serverwatcher-3.6.4/src/serverwatcher/defaultconfigs/messages.yaml +0 -47
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/LICENSE +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/README.md +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/setup.cfg +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/__init__.py +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/config/__init__.py +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/config/global_config.py +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/config/watcher.py +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/defaultconfigs/global.yaml +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/defaultconfigs/watcher.yaml +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher/schema.py +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher.egg-info/SOURCES.txt +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher.egg-info/dependency_links.txt +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher.egg-info/requires.txt +0 -0
- {serverwatcher-3.6.4 → serverwatcher-3.7.1}/src/serverwatcher.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
|
|
3
|
+
@dataclass
|
|
4
|
+
@dataclass
|
|
5
|
+
class MessagesConfig:
|
|
6
|
+
prefix: str
|
|
7
|
+
broadcast_restart_at: str
|
|
8
|
+
|
|
9
|
+
# minute messages
|
|
10
|
+
minute_120: str
|
|
11
|
+
minute_60: str
|
|
12
|
+
minute_45: str
|
|
13
|
+
minute_30: str
|
|
14
|
+
minute_15: str
|
|
15
|
+
minute_5: str
|
|
16
|
+
minute_1: str
|
|
17
|
+
|
|
18
|
+
# second messages
|
|
19
|
+
second_10: str
|
|
20
|
+
second_9: str
|
|
21
|
+
second_8: str
|
|
22
|
+
second_7: str
|
|
23
|
+
second_6: str
|
|
24
|
+
second_5: str
|
|
25
|
+
second_4: str
|
|
26
|
+
second_3: str
|
|
27
|
+
second_2: str
|
|
28
|
+
second_1: str
|
|
29
|
+
|
|
30
|
+
# logging
|
|
31
|
+
log_start: str
|
|
32
|
+
log_validation_fail: str
|
|
33
|
+
log_validation_ok: str
|
|
34
|
+
log_immediate_restart: str
|
|
35
|
+
log_no_restart: str
|
|
36
|
+
log_scheduled: str
|
|
37
|
+
log_gap_low: str
|
|
38
|
+
log_gap_high: str
|
|
39
|
+
|
|
40
|
+
# reasons
|
|
41
|
+
reason_restart_soon: str
|
|
42
|
+
reason_ram: str
|
|
43
|
+
reason_cpu: str
|
|
44
|
+
reason_uptime: str
|
|
45
|
+
reason_tps: str
|
|
46
|
+
reason_low_uptime: str
|
|
47
|
+
reason_players: str
|
|
48
|
+
|
|
49
|
+
# restarts
|
|
50
|
+
restart_action_sent: str
|
|
51
|
+
server_back_online: str
|
|
52
|
+
server_back_online_broadcast: str
|
|
53
|
+
server_failed_restart: str
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
prefix: "<aqua>[Server Watcher]"
|
|
2
|
+
|
|
3
|
+
broadcast_restart_at: "{prefix} The server will restart at {time} CDT."
|
|
4
|
+
|
|
5
|
+
broadcast_minute:
|
|
6
|
+
minute_120: "{prefix} Restart in 2 hours!"
|
|
7
|
+
minute_60: "{prefix} Restart in 1 hour!"
|
|
8
|
+
minute_45: "{prefix} Restart in 45 minutes!"
|
|
9
|
+
minute_30: "{prefix} Restart in 30 minutes!"
|
|
10
|
+
minute_15: "{prefix} Restart in 15 minutes!"
|
|
11
|
+
minute_5: "{prefix} Restart in 5 minutes!"
|
|
12
|
+
minute_1: "{prefix} Restart in 1 minute!"
|
|
13
|
+
|
|
14
|
+
broadcast_second:
|
|
15
|
+
second_10: "{prefix} Restart in 10 seconds!"
|
|
16
|
+
second_9: "{prefix} Restart in 9 seconds!"
|
|
17
|
+
second_8: "{prefix} Restart in 8 seconds!"
|
|
18
|
+
second_7: "{prefix} Restart in 7 seconds!"
|
|
19
|
+
second_6: "{prefix} Restart in 6 seconds!"
|
|
20
|
+
second_5: "{prefix} Restart in 5 seconds!"
|
|
21
|
+
second_4: "{prefix} Restart in 4 seconds!"
|
|
22
|
+
second_3: "{prefix} Restart in 3 seconds!"
|
|
23
|
+
second_2: "{prefix} Restart in 2 seconds!"
|
|
24
|
+
second_1: "{prefix} Restart in 1 second!"
|
|
25
|
+
|
|
26
|
+
logging:
|
|
27
|
+
log_start: "ServerWatcher is running!"
|
|
28
|
+
log_validation_fail: "Validation FAILED."
|
|
29
|
+
log_validation_ok: "All validation checks succeeded."
|
|
30
|
+
log_immediate_restart: "Restarting immediately."
|
|
31
|
+
log_no_restart: "The server does not need to restart."
|
|
32
|
+
log_scheduled: "Restart needed, but anti-restart factors outweigh it."
|
|
33
|
+
log_gap_low: "Gap {gap}. Scheduling restart in 2 hours."
|
|
34
|
+
log_gap_high: "Gap {gap}. Scheduling restart in 1 hour."
|
|
35
|
+
|
|
36
|
+
reasons:
|
|
37
|
+
reason_restart_soon: "The server is set to restart soon"
|
|
38
|
+
reason_ram: "RAM usage ({ram}) is higher than {threshold} GB"
|
|
39
|
+
reason_cpu: "CPU usage ({cpu}) is higher than {threshold}%"
|
|
40
|
+
reason_uptime: "Uptime {uptime} exceeds {threshold}h"
|
|
41
|
+
reason_tps: "TPS {tps} is lower than {threshold}"
|
|
42
|
+
reason_low_uptime: "Uptime {uptime} is shorter than 30m"
|
|
43
|
+
reason_players: "There {verb} {count} {plural} online"
|
|
44
|
+
|
|
45
|
+
restarts:
|
|
46
|
+
restart_action_sent: "Restart action sent. Waiting..."
|
|
47
|
+
server_back_online: "Server is back online!"
|
|
48
|
+
server_back_online_broadcast: "{prefix} <green>Restart successful!"
|
|
49
|
+
server_failed_restart: "Server failed to restart!"
|
|
@@ -142,22 +142,40 @@ class ServerWatcher:
|
|
|
142
142
|
local_time = scheduled.astimezone(self.tz)
|
|
143
143
|
time_str = local_time.strftime("%I:%M %p")
|
|
144
144
|
|
|
145
|
+
# Broadcast the scheduled restart time
|
|
145
146
|
self.server.sendBroadcast(
|
|
146
147
|
self.fmt(self.messages.broadcast_restart_at, time=time_str)
|
|
147
148
|
)
|
|
148
149
|
|
|
150
|
+
# Collect all minute_* keys
|
|
151
|
+
minute_keys = [
|
|
152
|
+
k for k in vars(self.messages)
|
|
153
|
+
if k.startswith("minute_")
|
|
154
|
+
]
|
|
155
|
+
|
|
149
156
|
minute_callbacks = {
|
|
150
|
-
|
|
151
|
-
self.
|
|
152
|
-
|
|
157
|
+
int(k.split("_")[1]): (
|
|
158
|
+
lambda msg=self.fmt(getattr(self.messages, k)):
|
|
159
|
+
self.server.sendBroadcast(msg)
|
|
160
|
+
)
|
|
161
|
+
for k in minute_keys
|
|
153
162
|
}
|
|
154
163
|
|
|
164
|
+
# Collect all second_* keys
|
|
165
|
+
second_keys = [
|
|
166
|
+
k for k in vars(self.messages)
|
|
167
|
+
if k.startswith("second_")
|
|
168
|
+
]
|
|
169
|
+
|
|
155
170
|
second_callbacks = {
|
|
156
|
-
|
|
157
|
-
self.
|
|
158
|
-
|
|
171
|
+
int(k.split("_")[1]): (
|
|
172
|
+
lambda msg=self.fmt(getattr(self.messages, k)):
|
|
173
|
+
self.server.sendBroadcast(msg)
|
|
174
|
+
)
|
|
175
|
+
for k in second_keys
|
|
159
176
|
}
|
|
160
177
|
|
|
178
|
+
|
|
161
179
|
runCountdownEvents(
|
|
162
180
|
target_time=scheduled,
|
|
163
181
|
minute_callbacks=minute_callbacks,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass, field
|
|
2
|
-
|
|
3
|
-
@dataclass
|
|
4
|
-
class MessagesConfig:
|
|
5
|
-
prefix: str
|
|
6
|
-
broadcast_restart_at: str
|
|
7
|
-
broadcast_minute: dict = field(default_factory=dict)
|
|
8
|
-
broadcast_second: dict = field(default_factory=dict)
|
|
9
|
-
|
|
10
|
-
log_start: str = ""
|
|
11
|
-
log_validation_fail: str = ""
|
|
12
|
-
log_validation_ok: str = ""
|
|
13
|
-
log_immediate_restart: str = ""
|
|
14
|
-
log_no_restart: str = ""
|
|
15
|
-
log_scheduled: str = ""
|
|
16
|
-
log_gap_low: str = ""
|
|
17
|
-
log_gap_high: str = ""
|
|
18
|
-
|
|
19
|
-
reason_restart_soon: str = ""
|
|
20
|
-
reason_ram: str = ""
|
|
21
|
-
reason_cpu: str = ""
|
|
22
|
-
reason_uptime: str = ""
|
|
23
|
-
reason_tps: str = ""
|
|
24
|
-
reason_low_uptime: str = ""
|
|
25
|
-
reason_players: str = ""
|
|
26
|
-
|
|
27
|
-
restart_action_sent: str = ""
|
|
28
|
-
server_back_online: str = ""
|
|
29
|
-
server_back_online_broadcast: str = ""
|
|
30
|
-
server_failed_restart: str = ""
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
prefix: "<aqua>[Server Watcher]"
|
|
2
|
-
|
|
3
|
-
broadcast_restart_at: "{prefix} The server will restart at {time} CDT."
|
|
4
|
-
|
|
5
|
-
broadcast_minute:
|
|
6
|
-
120: "{prefix} Restart in 2 hours!"
|
|
7
|
-
60: "{prefix} Restart in 1 hour!"
|
|
8
|
-
45: "{prefix} Restart in 45 minutes!"
|
|
9
|
-
30: "{prefix} Restart in 30 minutes!"
|
|
10
|
-
15: "{prefix} Restart in 15 minutes!"
|
|
11
|
-
5: "{prefix} Restart in 5 minutes!"
|
|
12
|
-
1: "{prefix} Restart in 1 minute!"
|
|
13
|
-
|
|
14
|
-
broadcast_second:
|
|
15
|
-
10: "{prefix} Restart in 10 seconds!"
|
|
16
|
-
9: "{prefix} Restart in 9 seconds!"
|
|
17
|
-
8: "{prefix} Restart in 8 seconds!"
|
|
18
|
-
7: "{prefix} Restart in 7 seconds!"
|
|
19
|
-
6: "{prefix} Restart in 6 seconds!"
|
|
20
|
-
5: "{prefix} Restart in 5 seconds!"
|
|
21
|
-
4: "{prefix} Restart in 4 seconds!"
|
|
22
|
-
3: "{prefix} Restart in 3 seconds!"
|
|
23
|
-
2: "{prefix} Restart in 2 seconds!"
|
|
24
|
-
1: "{prefix} Restart in 1 second!"
|
|
25
|
-
|
|
26
|
-
log_start: "ServerWatcher is running!"
|
|
27
|
-
log_validation_fail: "Validation FAILED."
|
|
28
|
-
log_validation_ok: "All validation checks succeeded."
|
|
29
|
-
log_immediate_restart: "Restarting immediately."
|
|
30
|
-
log_no_restart: "The server does not need to restart."
|
|
31
|
-
log_scheduled: "Restart needed, but anti-restart factors outweigh it."
|
|
32
|
-
log_gap_low: "Gap {gap}. Scheduling restart in 2 hours."
|
|
33
|
-
log_gap_high: "Gap {gap}. Scheduling restart in 1 hour."
|
|
34
|
-
|
|
35
|
-
reason_restart_soon: "The server is set to restart soon"
|
|
36
|
-
reason_ram: "RAM usage ({ram}) is higher than {threshold} GB"
|
|
37
|
-
reason_cpu: "CPU usage ({cpu}) is higher than {threshold}%"
|
|
38
|
-
reason_uptime: "Uptime {uptime} exceeds {threshold}h"
|
|
39
|
-
reason_tps: "TPS {tps} is lower than {threshold}"
|
|
40
|
-
reason_low_uptime: "Uptime {uptime} is shorter than 30m"
|
|
41
|
-
reason_players: "There {verb} {count} {plural} online"
|
|
42
|
-
|
|
43
|
-
# New values, will reorder later
|
|
44
|
-
restart_action_sent: "Restart action sent. Waiting..."
|
|
45
|
-
server_back_online: "Server is back online!"
|
|
46
|
-
server_back_online_broadcast: "{prefix} <green>Restart successful!"
|
|
47
|
-
server_failed_restart: "Server failed to restart!"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|