Compare commits
58
Commits
6e80f9fba2
...
v1.01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4514b880d | ||
|
|
e092924c08 | ||
|
|
e7f0e04b1d | ||
|
|
9a61e543c7 | ||
|
|
0ee51eda60 | ||
|
|
95a672af4f | ||
|
|
b609f62b14 | ||
|
|
9967235640 | ||
|
|
095c657d63 | ||
|
|
2d49b17a72 | ||
|
|
96cc58fe7f | ||
|
|
df748e5990 | ||
|
|
a4eb09e4a7 | ||
|
|
e1b3c2a4fc | ||
|
|
8e3d004434 | ||
|
|
acf1c6a892 | ||
|
|
fce7f8b28b | ||
|
|
8fbb9de3a4 | ||
|
|
33ba079ae4 | ||
|
|
f20a5828ec | ||
|
|
46c0e3b542 | ||
|
|
1ecce8636c | ||
|
|
d68d760b5e | ||
|
|
b3f4edea5b | ||
|
|
26282d2c3d | ||
|
|
548541e4d3 | ||
|
|
1835ad3188 | ||
|
|
52500d23ed | ||
|
|
4c9df6c6a4 | ||
|
|
3d7b977f50 | ||
|
|
f45ce65c74 | ||
|
|
3fa7cec025 | ||
|
|
1d97160776 | ||
|
|
6dfa8ac2e4 | ||
|
|
f87f90bfa9 | ||
|
|
8cc63244de | ||
|
|
cb7ef4667c | ||
|
|
e15e4db16d | ||
|
|
372827821a | ||
|
|
43d6546e2a | ||
|
|
7c5911ffa8 | ||
|
|
38bf7e204e | ||
|
|
7a4ed46cb5 | ||
|
|
1a9d3ce1e4 | ||
|
|
e481ed08d8 | ||
|
|
0fbd021569 | ||
|
|
4aef7e6f7c | ||
|
|
68ee0ed6f6 | ||
|
|
cced3d91f3 | ||
|
|
e81dfe21cf | ||
|
|
f1834a91d8 | ||
|
|
41e65eb778 | ||
|
|
fd975299ac | ||
|
|
55308c534f | ||
|
|
f28d0fe221 | ||
|
|
c0262fd84a | ||
|
|
391fa66490 | ||
|
|
ef254ecb12 |
@@ -0,0 +1,24 @@
|
||||
steps:
|
||||
- name: build
|
||||
image: git.zunet.ru/iu/nuitka:v215
|
||||
commands:
|
||||
- nuitka3 src/main.py -o baloon
|
||||
- ls -lh
|
||||
- file baloon
|
||||
|
||||
- name: release
|
||||
# image: woodpeckerci/plugin-gitea-release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
base_url: https://git.zunet.ru
|
||||
files:
|
||||
- "baloon"
|
||||
api_key:
|
||||
from_secret: SEC1
|
||||
target: main
|
||||
title: Ti ${CI_COMMIT_TAG##v}
|
||||
|
||||
when:
|
||||
- event: tag
|
||||
ref: refs/tags/v*
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM python:3
|
||||
|
||||
RUN pip install -U nuitka
|
||||
+10
-6
@@ -16,19 +16,23 @@ def set_utilization(fs, utilization_percent=0.6, baloon_filename='baloon', hyste
|
||||
hysteresis = int(du.total * hysteresis_percent)
|
||||
if hysteresis < BS: hysteresis = BS
|
||||
to_be_wasted = int(((du.used+du.free) * utilization_percent) - ((du.used+du.free) - du.free))
|
||||
baloon_filename = os.path.join(fs, baloon_filename)
|
||||
if not quiet:
|
||||
print(f'hysteresis: {hysteresis}bytes')
|
||||
print(f'total: {round(du.total/ 2**30, 3)}GB, used: {round(du.used/ 2**30, 3)}GB, free: {round(du.free/ 2**30, 3)}GB usage: {round(du.used * 100 / (du.used+du.free), 3)}%')
|
||||
print(f'to_be_wasted: {round(to_be_wasted/ 2**30, 3)}GB ')
|
||||
if to_be_wasted < -hysteresis:
|
||||
to_be_trimmed = abs(to_be_wasted)
|
||||
baloon_size = os.path.getsize(os.path.join(fs, baloon_filename))
|
||||
if baloon_size> to_be_trimmed:
|
||||
os.truncate(os.path.join(fs, baloon_filename), baloon_size - to_be_trimmed)
|
||||
to_be_trimmed = abs(to_be_wasted)
|
||||
baloon_size = os.path.getsize(baloon_filename)
|
||||
if baloon_size > to_be_trimmed:
|
||||
os.truncate(baloon_filename, baloon_size - to_be_trimmed)
|
||||
if not quiet: print(f'trimmed {to_be_trimmed} Bytes')
|
||||
elif not quiet: print(f'can\'t trim {baloon_size} < {to_be_trimmed}Bytes')
|
||||
else:
|
||||
if os.path.exists(baloon_filename):
|
||||
os.remove(baloon_filename)
|
||||
if not quiet and to_be_trimmed > baloon_size: print(f'can\'t trim {to_be_trimmed - baloon_size} Bytes')
|
||||
elif to_be_wasted > hysteresis:
|
||||
with open(os.path.join(fs, baloon_filename) , 'ab') as f:
|
||||
with open(baloon_filename , 'ab') as f:
|
||||
last = 0
|
||||
writed = to_be_wasted
|
||||
while to_be_wasted > 0:
|
||||
|
||||
Reference in New Issue
Block a user