Beispiel #1
0
 def test_parse_config_file(self):
     options = OptionParser()
     options.define("port", default=80)
     options.define("username", default='foo')
     options.parse_config_file(os.path.join(os.path.dirname(__file__),
                                            "options_test.cfg"))
     self.assertEquals(options.port, 443)
     self.assertEqual(options.username, "李康")
Beispiel #2
0
 def test_parse_config_file(self):
     options = OptionParser()
     options.define("port", default=80)
     options.define("username", default='foo')
     options.parse_config_file(
         os.path.join(os.path.dirname(__file__), "options_test.cfg"))
     self.assertEquals(options.port, 443)
     self.assertEqual(options.username, "李康")
Beispiel #3
0
 def test_dash_underscore_file(self):
     # No matter how an option was defined, it can be set with underscores
     # in a config file.
     for defined_name in ['foo-bar', 'foo_bar']:
         options = OptionParser()
         options.define(defined_name)
         options.parse_config_file(os.path.join(os.path.dirname(__file__),
                                                "options_test.cfg"))
         self.assertEqual(options.foo_bar, 'a')
Beispiel #4
0
 def test_parse_config_file(self):
     options = OptionParser()
     options.define("port", default=80)
     options.define("username", default="foo")
     options.define("my_path")
     config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                "options_test.cfg")
     options.parse_config_file(config_path)
     self.assertEqual(options.port, 443)
     self.assertEqual(options.username, "李康")
     self.assertEqual(options.my_path, config_path)
Beispiel #5
0
 def test_parse_config_file(self):
     options = OptionParser()
     options.define("port", default=80)
     options.define("username", default="foo")
     options.define("my_path")
     config_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)), "options_test.cfg"
     )
     options.parse_config_file(config_path)
     self.assertEqual(options.port, 443)
     self.assertEqual(options.username, "李康")
     self.assertEqual(options.my_path, config_path)
Beispiel #6
0
def load_config():
    options = OptionParser()
    options.define('port', default=8888, help='run on the given port', type=int)
    options.define('debug', default=False, help='run in debug mode')
    options.define('api_allowed_host', default='localhost', help='origin host that has access to API')
    options.define('history_size', default=50, help='number of tweets stored in memoty', type=int)
    options.define('config', type=str, help='path to config file',
                   callback=lambda path: options.parse_config_file(path, final=False))
    options.define('logging', default='error', help='logging level')
    options.parse_command_line()
    return options
Beispiel #7
0
def define_options():
    options = OptionParser()
    options.define('port', default=8181, type=int, help='port to listen on')
    options.define('microscope_name',
                   default="",
                   type=str,
                   help='Name of the microscope')
    options.define(
        'warp_prefix',
        help=
        "Parent folder of all warp folders in the user facility's organization scheme.",
        group="folders")
    options.define(
        'warp_suffix',
        default=None,
        help=
        "Child of the session-specific folder where warp output will be kept. Depends on workflow.",
        type=str,
        group="folders")
    options.define(
        'live2d_prefix',
        help=
        "Parent where live2d output folders will be generated. If this is the same as the warp_prefix, a live_2d suffix is recommended.",
        group="folders")
    options.define(
        'live2d_suffix',
        default=None,
        help=
        "Child of the session-specific folder where live2d output will be saved.",
        type=str,
        group="folders")
    options.define(
        'listening_period_ms',
        default=120000,
        type=int,
        help='How long to wait between automatic job trigger checks, in ms')
    options.define(
        'tail_log_period_ms',
        default=15000,
        type=int,
        help=
        'How long to wait between sending the latest log lines to the clients, in ms'
    )
    options.define(
        'websocket_ping_interval',
        default=30,
        type=int,
        help='Period between ping pongs to keep connections alive, in seconds',
        group='settings')
    options.define(
        'process_pool_size',
        default=32,
        type=int,
        help=
        'Total number of logical processors to use for multi-process refine2d jobs'
    )
    # Settings related to actually operating the webpage
    options.parse_config_file(os.path.join(config_folder,
                                           "server_settings.conf"),
                              final=False)
    options.parse_command_line()
    return options