import time import threading from broker.utils.openstack import connector as os_connector from broker.plugins import base from broker.utils.framework import monitor from broker.utils.framework import controller from broker.service import api from broker.utils import logger from broker.utils.ids import ID_Generator from broker.plugins.base import GenericApplicationExecutor LOG = logger.Log("OpenStackGenericPlugin", "logs/openstack_generic_plugin.log") application_time_log = logger.Log("Application_time", "logs/application_time.log") logger.configure_logging() class OpenStackApplicationExecutor(GenericApplicationExecutor): def __init__(self): self.application_state = "None" self.state_lock = threading.RLock() self.application_time = -1 self.start_time = -1 def get_application_state(self): with self.state_lock: state = self.application_state return state def update_application_state(self, state):
from broker.utils.framework import monitor from broker.utils.framework import optimizer from broker.utils import remote from broker.utils.framework import controller from broker.utils import spark from broker.utils.logger import Log, configure_logging from saharaclient.api.base import APIException as SaharaAPIException from broker.utils.ids import ID_Generator from broker.plugins.base import GenericApplicationExecutor plugin_log = Log("Sahara_Plugin", "logs/sahara_plugin.log") application_time_log = Log("Application_Time", "logs/application_time.log") instances_log = Log("Instances", "logs/instances.log") configure_logging() class OpenStackSparkApplicationExecutor(GenericApplicationExecutor): def __init__(self, app_id): self.application_state = "None" self.state_lock = threading.RLock() self.application_time = -1 self.start_time = -1 self.app_id = app_id self._verify_existing_log_paths(app_id) self._clean_log_files(app_id) self.running_log = Log("Running_Application_%s" % app_id, "logs/apps/%s/execution" % app_id)
def main(): app = Flask(__name__) app.register_blueprint(rest) logger.configure_logging() app.run(host='0.0.0.0', port=api.port)