-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from wguanicedew/main
upgrade panda system to new stable version
- Loading branch information
Showing
30 changed files
with
232 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ main: | |
enabled: true | ||
|
||
image: | ||
tag: "v0.6.17" | ||
tag: "v0.6.25" | ||
|
||
autoStart: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
helm/harvester/charts/harvester/sandbox/health_monitor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
check harvester health | ||
""" | ||
|
||
import os | ||
import re | ||
import subprocess | ||
|
||
|
||
def check_command(command, check_string): | ||
print("Checking command : {0}".format(command)) | ||
print("For string : {0}".format(check_string)) | ||
|
||
tmp_array = command.split() | ||
output = ( | ||
subprocess.Popen(tmp_array, stdout=subprocess.PIPE) | ||
.communicate()[0] | ||
.decode("ascii") | ||
) | ||
|
||
if re.search(check_string, output): | ||
print("Found the string, return 100") | ||
return 100 | ||
else: | ||
print("String not found, return 0") | ||
return 0 | ||
|
||
|
||
def uwsgi_process_availability(): | ||
# check the uwsgi | ||
process_avail = 0 | ||
output = ( | ||
subprocess.Popen( | ||
"ps -eo pgid,args | grep uwsgi | grep -v grep", | ||
stdout=subprocess.PIPE, | ||
shell=True, | ||
) | ||
.communicate()[0] | ||
.decode("ascii") | ||
) | ||
count = 0 | ||
for line in output.split("\n"): | ||
line = line.strip() | ||
if line == "": | ||
continue | ||
count += 1 | ||
if count >= 1: | ||
process_avail = 100 | ||
|
||
print("uwsgi process check availability: %s" % process_avail) | ||
return process_avail | ||
|
||
|
||
def condor_process_availability(): | ||
# check the condor | ||
process_avail = 0 | ||
output = ( | ||
subprocess.Popen( | ||
"ps -eo pgid,args | grep condor_schedd | grep -v grep", | ||
stdout=subprocess.PIPE, | ||
shell=True, | ||
) | ||
.communicate()[0] | ||
.decode("ascii") | ||
) | ||
count = 0 | ||
for line in output.split("\n"): | ||
line = line.strip() | ||
if line == "": | ||
continue | ||
count += 1 | ||
if count >= 1: | ||
process_avail = 100 | ||
|
||
print("condor_q process check availability: %s" % process_avail) | ||
return process_avail | ||
|
||
|
||
def condor_q_availability(): | ||
# check the condor_q | ||
process_avail = 0 | ||
try: | ||
result = subprocess.run( | ||
["condor_q"], | ||
timeout=10, # Timeout in seconds | ||
capture_output=True, | ||
text=True | ||
) | ||
print(f"command output: {result.stdout}") | ||
process_avail = 100 | ||
except subprocess.TimeoutExpired: | ||
print("The command timed out!") | ||
process_avail = 0 | ||
|
||
print("condor_q process check availability: %s" % process_avail) | ||
return process_avail | ||
|
||
|
||
def main(): | ||
uwsgi_avail, condor_avail, condor_q_avail = 0, 0, 0 | ||
try: | ||
uwsgi_avail = uwsgi_process_availability() | ||
condor_avail = condor_process_availability() | ||
condor_q_avail = condor_q_availability() | ||
except Exception as ex: | ||
print(f"failed to check availability: {ex}") | ||
|
||
print(f"uwsgi_avail: {uwsgi_avail}, condor_avail: {condor_avail}, condor_q_avail: {condor_q_avail}") | ||
|
||
health_monitor_file = "/var/log/panda/harvester_healthy" | ||
if uwsgi_avail and condor_avail and condor_q_avail: | ||
with open(health_monitor_file, 'w') as f: | ||
f.write("OK") | ||
else: | ||
if os.path.exists(health_monitor_file): | ||
os.remove(health_monitor_file) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
source /opt/harvester/bin/activate | ||
source /data/condor/condor/condor.sh | ||
|
||
python /data/harvester/health_monitor.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
helm/harvester/charts/harvester/sandbox/lsst.submit_pilot_pull_srun.sdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.