[bonfiredemokit] Annotation of /virt-cluster/vc/vc-node-execd.py
Annotation of /virt-cluster/vc/vc-node-execd.py
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
(as text)
1 : |
agomez |
1 |
#!/usr/bin/python
|
2 : |
|
|
import socket
|
3 : |
|
|
import bonfire
|
4 : |
|
|
import ogs
|
5 : |
|
|
import sys
|
6 : |
|
|
import time
|
7 : |
|
|
import vcutil
|
8 : |
|
|
|
9 : |
|
|
from logger import log,configure
|
10 : |
|
|
if len(sys.argv) >1:
|
11 : |
|
|
configure(logfile = sys.argv[1], debug=True, console=False)
|
12 : |
|
|
else:
|
13 : |
|
|
configure(debug=True, console=True)
|
14 : |
|
|
|
15 : |
|
|
default_bonfire = "/etc/default/bonfire"
|
16 : |
|
|
bonfire.read_defaults(default_bonfire)
|
17 : |
|
|
log.info("Bonfire URI: %s" % bonfire.uri)
|
18 : |
|
|
log.info("Credentials: %s:%s" % (bonfire.user,bonfire.password,))
|
19 : |
|
|
log.info("Experiment: %s" % bonfire.experiment_id)
|
20 : |
|
|
|
21 : |
|
|
while True:
|
22 : |
|
|
try:
|
23 : |
|
|
log.info("Get hostname")
|
24 : |
|
|
hostname = socket.gethostname()
|
25 : |
|
|
log.info("I am %s" % hostname)
|
26 : |
|
|
#Check if it is registered
|
27 : |
|
|
log.info("Get hosts")
|
28 : |
|
|
hosts = ogs.get_execution_hosts()
|
29 : |
|
|
log.debug(hosts)
|
30 : |
|
|
if hostname in hosts:
|
31 : |
|
|
log.info("Starting execd")
|
32 : |
|
|
ogs.start_execd()
|
33 : |
|
|
break
|
34 : |
|
|
except Exception as excpt:
|
35 : |
|
|
log.exception(excpt)
|
36 : |
|
|
time.sleep(20)
|
37 : |
|
|
|
38 : |
|
|
|
39 : |
|
|
|
40 : |
|
|
|
41 : |
|
|
|
|