コード例 #1
0
ファイル: utils.py プロジェクト: kenbeese/DataProcessor
def debug(args):
    port = int(args.port)
    data_path = utility.abspath(args.json)
    utility.check_file(data_path)
    app.config["DATA_PATH"] = data_path
    app.config["SECRET_KEY"] = "development key"
    app.run(debug=True, port=port)
コード例 #2
0
def debug(args):
    port = int(args.port)
    data_path = utility.abspath(args.json)
    utility.check_file(data_path)
    app.config["DATA_PATH"] = data_path
    app.config["SECRET_KEY"] = "development key"
    app.run(debug=True, port=port)
コード例 #3
0
ファイル: utils.py プロジェクト: kenbeese/DataProcessor
def start(args):
    port = int(args.port)
    log_path = args.logfilepath
    lock_path = args.lockfile
    data_path = utility.abspath(args.json)
    utility.check_file(data_path)
    app.config["DATA_PATH"] = data_path
    app.config["SECRET_KEY"] = "development key"
    if not op.exists(lock_path):
        dc = DaemonContext(pidfile=PIDLockFile(lock_path),
                           stderr=open(log_path, "w+"),
                           working_directory=ROOT)
        with dc:
            app.run(port=port)
    else:
        raise exception.DataProcessorError("Server already stands.")
コード例 #4
0
def start(args):
    port = int(args.port)
    log_path = args.logfilepath
    lock_path = args.lockfile
    data_path = utility.abspath(args.json)
    utility.check_file(data_path)
    app.config["DATA_PATH"] = data_path
    app.config["SECRET_KEY"] = "development key"
    if not op.exists(lock_path):
        dc = DaemonContext(pidfile=PIDLockFile(lock_path),
                           stderr=open(log_path, "w+"),
                           working_directory=ROOT)
        with dc:
            app.run(port=port)
    else:
        raise exception.DataProcessorError("Server already stands.")
コード例 #5
0
ファイル: test_utility.py プロジェクト: marubu/DataProcessor
    def test_check_file(self):
        tempfile = os.path.join(self.tempdir, "foo")
        relative_path = os.path.relpath(tempfile)
        with self.assertRaises(DataProcessorError):
            utility.check_file(tempfile)
        open(tempfile, "a").close()
        self.assertEqual(utility.check_file(tempfile), tempfile)
        self.assertEqual(utility.check_file(relative_path), tempfile)

        dir_path = os.path.join(self.tempdir, "bar")
        relative_path = os.path.relpath(dir_path)
        with self.assertRaises(DataProcessorError):
            utility.check_file(dir_path)
        os.mkdir(dir_path)
        with self.assertRaises(DataProcessorError):
            utility.check_file(dir_path)
        with self.assertRaises(DataProcessorError):
            utility.check_file(relative_path)