[bonfiredemokit] Annotation of /virt-cluster/vc/vc-node-execd.py
Annotation of /virt-cluster/vc/vc-node-execd.py
Parent Directory
| Revision Log
Revision 9 -
(view)
(download)
(as text)
1 : |
agomez |
1 |
#!/usr/bin/python
|
2 : |
agomez |
9 |
#
|
3 : |
|
|
# BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit
|
4 : |
|
|
#
|
5 : |
|
|
# Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012
|
6 : |
|
|
#
|
7 : |
|
|
# License GPL Version 3
|
8 : |
|
|
#
|
9 : |
|
|
# The research leading to these results has received funding from
|
10 : |
|
|
# the European Community's Seventh Frameqork Programme (FP7/2007-2013)
|
11 : |
|
|
# under agreement number 257386
|
12 : |
|
|
#
|
13 : |
|
|
# This software is provided with ABSOLUTELY NO WARRANTY
|
14 : |
|
|
#
|
15 : |
agomez |
1 |
import socket
|
16 : |
|
|
import bonfire
|
17 : |
|
|
import ogs
|
18 : |
|
|
import sys
|
19 : |
|
|
import time
|
20 : |
|
|
import vcutil
|
21 : |
|
|
|
22 : |
|
|
from logger import log,configure
|
23 : |
|
|
if len(sys.argv) >1:
|
24 : |
|
|
configure(logfile = sys.argv[1], debug=True, console=False)
|
25 : |
|
|
else:
|
26 : |
|
|
configure(debug=True, console=True)
|
27 : |
|
|
|
28 : |
|
|
default_bonfire = "/etc/default/bonfire"
|
29 : |
|
|
bonfire.read_defaults(default_bonfire)
|
30 : |
|
|
log.info("Bonfire URI: %s" % bonfire.uri)
|
31 : |
|
|
log.info("Credentials: %s:%s" % (bonfire.user,bonfire.password,))
|
32 : |
|
|
log.info("Experiment: %s" % bonfire.experiment_id)
|
33 : |
|
|
|
34 : |
|
|
while True:
|
35 : |
|
|
try:
|
36 : |
|
|
log.info("Get hostname")
|
37 : |
|
|
hostname = socket.gethostname()
|
38 : |
|
|
log.info("I am %s" % hostname)
|
39 : |
|
|
#Check if it is registered
|
40 : |
|
|
log.info("Get hosts")
|
41 : |
|
|
hosts = ogs.get_execution_hosts()
|
42 : |
|
|
log.debug(hosts)
|
43 : |
|
|
if hostname in hosts:
|
44 : |
|
|
log.info("Starting execd")
|
45 : |
|
|
ogs.start_execd()
|
46 : |
|
|
break
|
47 : |
|
|
except Exception as excpt:
|
48 : |
|
|
log.exception(excpt)
|
49 : |
|
|
time.sleep(20)
|
50 : |
|
|
|
51 : |
|
|
|
52 : |
|
|
|
53 : |
|
|
|
54 : |
|
|
|
|