Пример #1
0
    parser = argparse.ArgumentParser(
        description="Training model and saving it")
    parser.add_argument("--port",
                        "-p",
                        required=False,
                        default=8080,
                        type=int,
                        help="Port number for the Flask server")
    parser.add_argument("--debug",
                        "-d",
                        action="store_true",
                        help="Enables debug mode in the Flask server")
    parser.add_argument(
        "--local",
        "-l",
        required=False,
        default=False,
        type=bool,
        help="setting dummy user name and password for local development")

    flask_args = parser.parse_args()

    initialize_logging("prediction.log")

    if flask_args.local:
        username = "******"
        password = "******"
        app.config['USERS'][username] = password

    app.run('0.0.0.0', flask_args.port, debug=debug_mode() or flask_args.debug)
Пример #2
0
    else:
        training_exc = _executor.futures.exception(TRAINING_KEY)
        _executor.futures.pop(TRAINING_KEY)
        if training_exc:
            return jsonify({
                'finished':
                "Training ended with error: {}".format(training_exc)
            }), 500
        else:
            return jsonify({'finished': True}), 200


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description="Training model and saving it")
    parser.add_argument("--port",
                        "-p",
                        required=False,
                        default=8080,
                        type=int,
                        help="Port number for the Flask server")
    parser.add_argument("--debug",
                        "-d",
                        action="store_true",
                        help="Enables debug mode in the Flask server")

    flask_args = parser.parse_args()

    initialize_logging("training.log", flask_args.debug)
    app.run('0.0.0.0', flask_args.port, debug=debug_mode() or flask_args.debug)
Пример #3
0
        if training_exc:
            return jsonify({
                'finished':
                "Training ended with error: {}".format(training_exc)
            }), 500
        else:
            return jsonify({'finished': True}), 200


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description="Training model and saving it")
    parser.add_argument("--port",
                        "-p",
                        required=False,
                        default=8080,
                        type=int,
                        help="Port number for the Flask server")
    parser.add_argument("--debug",
                        "-d",
                        action="store_true",
                        help="Enables debug mode in the Flask server")

    flask_args = parser.parse_args()

    initialize_logging("training.log", flask_args.debug)
    app.run('0.0.0.0', flask_args.port, debug=debug_mode() or flask_args.debug)
else:
    initialize_logging(path="training.log", debug=os.getenv('DEBUG', False))
    gunicorn_app = app
"""
This file contains the script for executing the training in a remote machine
"""

if __name__ == '__main__':
    import argparse
    import os
    from services.infrastructure.logging import initialize_logging
    from model.trainer import train

    parser = argparse.ArgumentParser(description="Remote training script")
    parser.add_argument("--env",
                        "-e",
                        required=True,
                        type=str,
                        help="Environment folder/name")
    parser.add_argument("--debug",
                        "-d",
                        action="store_true",
                        help="Enables debug mode")

    args = parser.parse_args()

    os.chdir(args.env)
    initialize_logging(path="training-remote.log",
                       remote=True,
                       debug=args.debug)
    train()
Пример #5
0
                        "-p",
                        required=False,
                        default=8080,
                        type=int,
                        help="Port number for the Flask server")
    parser.add_argument("--debug",
                        "-d",
                        action="store_true",
                        help="Enables debug mode in the Flask server")
    parser.add_argument(
        "--local",
        "-l",
        required=False,
        default=False,
        type=bool,
        help="setting dummy user name and password for local development")

    flask_args = parser.parse_args()

    initialize_logging("prediction.log")

    if flask_args.local:
        username = "******"
        password = "******"
        app.config['USERS'][username] = password

    app.run('0.0.0.0', flask_args.port, debug=debug_mode() or flask_args.debug)
else:
    initialize_logging(path="prediction.log", debug=os.getenv('DEBUG', False))
    gunicorn_app = app