#!/usr/bin/python # # BonFIRE Virtual Clusters on Federated Clouds Demonstration Kit # # Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012 # # License GPL Version 3 # # The research leading to these results has received funding from # the European Community's Seventh Frameqork Programme (FP7/2007-2013) # under agreement number 257386 # # This software is provided with ABSOLUTELY NO WARRANTY # import socket import bonfire import ogs import sys import time import vcutil from logger import log,configure if len(sys.argv) >1: configure(logfile = sys.argv[1], debug=True, console=False) else: configure(debug=True, console=True) default_bonfire = "/etc/default/bonfire" bonfire.read_defaults(default_bonfire) log.info("Bonfire URI: %s" % bonfire.uri) log.info("Credentials: %s:%s" % (bonfire.user,bonfire.password,)) log.info("Experiment: %s" % bonfire.experiment_id) while True: try: log.info("Get hostname") hostname = socket.gethostname() log.info("I am %s" % hostname) #Check if it is registered log.info("Get hosts") hosts = ogs.get_execution_hosts() log.debug(hosts) if hostname in hosts: log.info("Starting execd") ogs.start_execd() break except Exception as excpt: log.exception(excpt) time.sleep(20)