balancer's People
balancer's Issues
Очень большая вложенность if
if (cpu_free < float(max_cpu) and max_cpu != '0'):
logging('Загрузка cpu=' + str(cpu_free) + '<' + max_cpu)
if (memory_free > max_ram):
logging('Свободная память:mem=' + str(memory_free) + '>' + str(max_ram))
if (upload < float(max_upload)) or max_upload == '0':
logging('Upload (Mbps): ' + str(upload) + '<' + max_upload)
if (download < float(max_download)) or max_download == '0':
logging('Download (Mbps): ' + str(download) + '<' + max_download)
if (flag_except_prog == False):
logging("Запущена ли программа-исключение:" + str(flag_except_prog))
logging('Все параметры в норме. Запускаем:' + exec_file)
# , creationflags=subprocess.CREATE_BREAKAWAY_FROM_JOB
success_var = subprocess.Popen(path_to_file + exec_file)
logging("Успешно")
pass
pass
pass
pass
pass
pass
pass
Когда большая вложенность if, то что-то пошло не так, предлагаю пересмотреть логику или же попробовать избавится от избыточной вложенности путем пересмотра условий, например вместо
if (cpu_free < float(max_cpu) and max_cpu != '0'):
написать, что-то типо
if cpu_free >= float(max_cpu) or max_cpu == '0':
continue
ну и тд
Но лучше подумать над общей структурой программы, разбить на ф-ции и тд
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.