This commit is contained in:
Lukáš Plevač 2024-12-07 15:56:21 +01:00
parent 559c344c43
commit eee83add5d
2 changed files with 16 additions and 6 deletions

View File

@ -2,10 +2,11 @@ pkgname=saturn-discover
pkgver=1.0
pkgrel=1
arch=('any')
source=('saturnDiscoverDeamon.py')
md5sums=('SKIP')
source=('saturnDiscoverDeamon.py' 'saturnDiscover.service')
md5sums=('SKIP' 'SKIP')
package() {
install -D -t "saturnDiscoverDeamon.py/usr/bin" "$srcdir/saturnDiscoverDeamon.py"
install -D -t "${pkgdir}/usr/bin" "$srcdir/saturnDiscoverDeamon.py"
install -m755 -d ${pkgdir}/usr/lib/systemd/system
install -m644 $startdir/saturnDiscover.service ${pkgdir}/usr/lib/systemd/system
}

View File

@ -44,13 +44,21 @@ def get_ip():
s.close()
return IP
def tryReadFile(fname, defval):
with open(fname, 'r') as file:
return file.read().replace('\n', '')
return defval
def selfInfo():
return {
"ip": get_ip(),
"type": TYPE,
"name": socket.gethostname(),
"cpus": os.cpu_count(),
"rams": os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
"rams": os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES'),
"res": json.loads(tryReadFile("/etc/slurm-llnl/localRes", "[]")),
"version": int(tryReadFile("/etc/slurm-llnl/confVer", 0))
}
@ -150,7 +158,6 @@ while True:
HOSTS[data["ip"]] = data
updateHosts()
generateHosts("/etc/hosts")
generateSlurmConfig("/etc/slurm-llnl/slurm.conf.template", "/etc/slurm-llnl/slurm.conf")
# configure network disks
if TYPE == "slave" and MASTER is not None and not nfsDone():
@ -158,7 +165,9 @@ while True:
os.system(f"echo \"{MASTER['ip']}:/home /home nfs defaults 0 0\" >> /etc/fstab")
os.system("mount -a")
os.system("cp -f /clusterfs/munge.key /etc/munge/munge.key")
os.system("cp -f /clusterfs/config/munge.key /etc/munge/munge.key")
generateSlurmConfig("/clusterfs/config/slurm.conf.template", "/etc/slurm-llnl/slurm.conf")
# reset all services
os.system("systemctl restart munge")