Beispiel #1
0
from context import app
from services.ws_service import ws_service_blueprint

__author__ = '*****@*****.**'

# Initialize application.
app = Flask("psdm_mongo_ws")
# Set the expiration for static files
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 300
app.secret_key = "This is a secret key that is somewhat temporary."
app.debug = bool(os.environ.get('DEBUG', "False"))

if app.debug:
    print("Sending all debug messages to the console")
    root = logging.getLogger()
    root.setLevel(logging.DEBUG)
    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    root.addHandler(ch)

# Register routes.
app.register_blueprint(ws_service_blueprint)

if __name__ == '__main__':
    print("Please use gunicorn for development as well.")
    sys.exit(-1)
app.debug = bool(os.environ.get('DEBUG', "False"))

if app.debug:
    print("Sending all debug messages to the console")
    root = logging.getLogger()
    root.setLevel(logging.DEBUG)
    logging.getLogger('kafka').setLevel(logging.INFO)
    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    root.addHandler(ch)


# Register routes.
app.register_blueprint(pages_blueprint, url_prefix="")
logbook_db.init_app(app)

def load_default_auto_runs():
    with open('default_auto_runs.json', 'r') as f:
        default_auto_runs = json.load(f)
        return default_auto_runs


def insert_autorun_entries():
    consumer = KafkaConsumer('experiment.register', bootstrap_servers=[os.environ.get("KAFKA_BOOTSTRAP_SERVER", "localhost:9092")])

    while True:
        msg = next(consumer)

        if msg:
Beispiel #3
0
app = Flask("psdm_ws_template")
# Set the expiration for static files
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 300; 

app.secret_key = "This is a secret key that is somewhat temporary."
app.debug = bool(os.environ.get('DEBUG', "False"))

if app.debug:
    print("Sending all debug messages to the console")
    root = logging.getLogger()
    root.setLevel(logging.DEBUG)
    logging.getLogger('kafka').setLevel(logging.INFO)
    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    root.addHandler(ch)


# Register routes.
app.register_blueprint(pages_blueprint, url_prefix="")
app.register_blueprint(business_service_blueprint, url_prefix="/ws/business")

socket_service.init_app(app, security, kafkatopics = ["elog"])

logbook_db.init_app(app)

if __name__ == '__main__':
    print("Please use gunicorn for development as well.")
    sys.exit(-1)