homeostasis
install
[SH] pip install homeostasis
documentation
[SH] homeostasis shares
health checks
create a status file
# status_1.py
def check_1 ():
print ("check 1")
def check_2 ():
print ("check 2")
def check_3 ():
raise Exception ("not 110%")
checks = {
"check 1": check_1,
"check 2": check_2,
"check 3": check_3
}
start
[SH] homeostasis status
start
create a project structure like this
/
/assurances
status_1.py
status.process.py
status_1.py
def check_1 ():
print ("check 1")
def check_2 ():
print ("check 2")
def check_3 ():
raise Exception ("NOT 100%")
checks = {
"check 1": check_1,
"check 2": check_2,
"check 3": check_3
}
start.process.py
import pathlib
this_directory = pathlib.Path (__file__).parent.resolve ()
from os.path import dirname, join, normpath
search_path = str (normpath (join (this_directory, "assurances")))
import homeostasis
scan = homeostasis.start (
glob_string = search_path + '/**/status_*.py',
simultaneous = True
)
notes
For each file path found in the glob, the "checks" dictionary is retrieved with the python "exec"
and then each "check" in "checks" is run.
Each check suite found by the glob is started by
a process with a flask API, that is opened on the first available port found.
if file in glob is empty
The scanner reports:
"empty": true
```