当前位置: 首页>>代码示例>>Python>>正文


Python ming.configure函数代码示例

本文整理汇总了Python中ming.configure函数的典型用法代码示例。如果您正苦于以下问题:Python configure函数的具体用法?Python configure怎么用?Python configure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了configure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: configure

def configure(args=None):
    '''Load the options and configure the system'''
    if args is None: args = sys.argv
    options, args = get_options(args)
    if options.verbose:
        log.info('Settings:')
        for k,v in sorted(options.__dict__.items()):
            log.info('  %s: %r', k, v)
    ming_config = {
        'ming.zarkov.master':options.mongo_uri,
        'ming.zarkov.database':options.mongo_database,
        'ming.zarkov.use_gevent':True}
    for dbinfo in options.extra_dbs:
        dbinfo = dict(dbinfo)
        prefix = 'ming.%s.' % dbinfo.pop('name')
        for k,v in dbinfo.items():
            ming_config[prefix + k] = v
    if options.mongo_username:
        ming_config['ming.zarkov.authenticate.name'] = options.mongo_username
    if options.mongo_username:
        ming_config['ming.zarkov.authenticate.password'] = options.mongo_password
    ming.configure(**ming_config)
    if options.pdb:
        sys.excepthook = postmortem_hook
    return options, args
开发者ID:joeywen,项目名称:zarkov,代码行数:25,代码来源:config.py

示例2: setup

def setup():
    global args, simconfig
    permitted_stage_tags = data.get_experiment_stage_tags()

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--collections", choices=['postclassification', 'traits', 'both'], help="Collections to retrofit ", required=True)

    args = parser.parse_args()

    simconfig = utils.CTPyConfiguration(args.configuration)

    if args.debug:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration()
    ming.configure(**config)
开发者ID:mmadsen,项目名称:CTPy,代码行数:27,代码来源:retrofit-slatkin-to-experiment.py

示例3: basic_setup

 def basic_setup(self):
     global log, M
     if self.args[0]:
         # Probably being called from the command line - load the config
         # file
         self.config = conf = appconfig('config:%s' %
                                        self.args[0], relative_to=os.getcwd())
         # ... logging does not understand section#subsection syntax
         logging_config = self.args[0].split('#')[0]
         logging.config.fileConfig(
             logging_config, disable_existing_loggers=False)
         log = logging.getLogger('allura.command')
         log.info('Initialize command with config %r', self.args[0])
         load_environment(conf.global_conf, conf.local_conf)
         self.setup_globals()
         from allura import model
         M = model
         ming.configure(**conf)
         if asbool(conf.get('activitystream.recording.enabled', False)):
             activitystream.configure(**h.convert_bools(conf, prefix='activitystream.'))
         pylons.tmpl_context.user = M.User.anonymous()
     else:
         # Probably being called from another script (websetup, perhaps?)
         log = logging.getLogger('allura.command')
         conf = pylons.config
     self.tools = pylons.app_globals.entry_points['tool'].values()
     for ep in h.iter_entry_points('allura.command_init'):
         log.info('Running command_init for %s', ep.name)
         ep.load()(conf)
     log.info('Loaded tools')
开发者ID:abhinavthomas,项目名称:allura,代码行数:30,代码来源:base.py

示例4: basic_setup

    def basic_setup(self):
        global log, M
        if self.args[0]:
            # Probably being called from the command line - load the config file
            self.config = conf = appconfig("config:%s" % self.args[0], relative_to=os.getcwd())
            # ... logging does not understand section#subsection syntax
            logging_config = self.args[0].split("#")[0]
            logging.config.fileConfig(logging_config, disable_existing_loggers=False)
            log = logging.getLogger("allura.command")
            log.info("Initialize command with config %r", self.args[0])
            load_environment(conf.global_conf, conf.local_conf)
            self.setup_globals()
            from allura import model

            M = model
            ming.configure(**conf)
            activitystream.configure(**conf)
            pylons.tmpl_context.user = M.User.anonymous()
        else:
            # Probably being called from another script (websetup, perhaps?)
            log = logging.getLogger("allura.command")
            conf = pylons.config
        self.tools = pylons.app_globals.entry_points["tool"].values()
        for ep in iter_entry_points("allura.command_init"):
            log.info("Running command_init for %s", ep.name)
            ep.load()(conf)
        log.info("Loaded tools")
开发者ID:johnsca,项目名称:incubator-allura,代码行数:27,代码来源:base.py

示例5: setup

def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment, to be used as prefix for database collections")
    parser.add_argument("--simid", help="simulation ID to export from database")
    parser.add_argument("--debug", type=int, help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--outputdirectory", help="path to directory for exported data files", required=True)

    args = parser.parse_args()

    if args.debug == 1:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')


    #### main program ####
    log.info("EXPORT DATA TO CSV - Experiment: %s  SimulationID: %s", args.experiment, args.simid)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
开发者ID:mmadsen,项目名称:seriationct,代码行数:25,代码来源:seriationct-export-single-simulation.py

示例6: setup

def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--parallelism", help="Number of concurrent processes to run", default="4")
    parser.add_argument("--diagram", help="Draw a diagram when complete", default=False)

    args = parser.parse_args()

    simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
开发者ID:mmadsen,项目名称:axelrod-ct,代码行数:27,代码来源:sim-extensible-parallel.py

示例7: setup

def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", required=True, help="provide name for experiment, to be used as prefix for database collections")
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--dryrun", help="Do the calculations but do not change the database (handiest with --debug 1 to see the results", action="store_true")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)


    if int(args.debug) == 1:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')


    #### main program ####
    log.info("CALCULATING GRAPH SYMMETRY STATS - Experiment: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
开发者ID:mmadsen,项目名称:axelrod-ct,代码行数:28,代码来源:calculate_graph_symmetry_stats.py

示例8: setUp

    def setUp(self):
        data.set_database_port("27017")
        data.set_database_hostname("localhost")
        data.set_experiment_name("testupdate")
        config = data.getMingConfiguration()
        ming.configure(**config)

        # clean out the collection
        data.PerGenerationStatsPostclassification.m.remove()

        self.data = dict(
            simulation_time=1000,
            classification_id=ObjectId("52056c3b3f07d50754eec1a3"),
            classification_type="EVEN",
            classification_dim=2,
            classification_coarseness=4,
            replication=0,
            sample_size=50,
            population_size=2000,
            mutation_rate=0.01,
            simulation_run_id="urn:uuid:07f75571-6f6b-4113-84c5-46cb8114cb72",
            mode_richness=[5,3],
            class_richness=2,
            mode_evenness_iqv=[0.5,0.3],
            class_evenness_iqv=0.25,
            design_space_occupation=None,
            class_innovation_interval_times=None
        )
开发者ID:mmadsen,项目名称:CTPy,代码行数:28,代码来源:test_update_data.py

示例9: setup

def setup(parser):
    config = parser.parse_args()

    sim_id = uuid.uuid1().urn
    script = __file__

    if config.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    data.set_experiment_name(config.experiment)
    data.set_database_hostname(config.dbhost)
    data.set_database_port(config.dbport)
    dbconfig = data.getMingConfiguration(data.modules)
    ming.configure(**dbconfig)

    # set up parallelism.  At the moment, this doesn't do anything on OSX
    # but should provide parallelism on Linux across the replicates at least

    if config.cores is not None:
        cores = config.cores
    else:
        cores = utils.get_parallel_cores(config.devel)
    log.info("Setting up %s cores for parallel simulation", cores)

    import simuOpt
    if(config.debug == 1):
        simuOpt.setOptions(alleleType='long',optimized=True,quiet=False,numThreads = cores)
    else:
        simuOpt.setOptions(alleleType='long',optimized=True,quiet=False,numThreads = cores)

    return (config,sim_id,script, cores)
开发者ID:mmadsen,项目名称:seriationct,代码行数:33,代码来源:sim-seriationct-networkmodel.py

示例10: setup

def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--filename", help="path to file for export", required=True)


    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)

    #### main program ####

    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
开发者ID:mmadsen,项目名称:axelrod-ct,代码行数:30,代码来源:treestructured-uniform-sampler.py

示例11: setup

def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", required=True, help="provide name for experiment, to be used as prefix for database collections")
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--finalized", help="Only export runs which finalized after convergence", action="store_true")
    parser.add_argument("--action", choices=["sample", "single", "bulk"])
    parser.add_argument("--ssize", help="Sample size of graphs to export", default="100")
    parser.add_argument("--id", help="Export trait graphs with this object id")
    parser.add_argument("--idfile", help="Export trait graphs for ids in file")
    parser.add_argument("--directory", help="Directory to which DOT files are written")

    args = parser.parse_args()


    if int(args.debug) == 1:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')


    #### main program ####
    log.info("EXPORT TRAIT GRAPHS AS DOT - Experiment: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
开发者ID:mmadsen,项目名称:axelrod-ct,代码行数:30,代码来源:export-traitgraph-to-graphviz.py

示例12: setup

def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--popsize", help="Population size", required=True)
    parser.add_argument("--numloci", help="Number of loci per individual", required=True)
    parser.add_argument("--maxinittraits", help="Max initial number of traits per locus for initialization", required=True)
    parser.add_argument("--conformismstrength", help="Strength of conformist bias [0.0 - 1.0]", required=True)
    parser.add_argument("--anticonformismstrength", help="Strength of conformist bias [0.0 - 1.0]", required=True)
    parser.add_argument("--innovationrate", help="Theta value rate at which innovations occur in population", required=True)
    parser.add_argument("--periodic", help="Periodic boundary condition", choices=['1','0'], required=True)
    parser.add_argument("--kandlerinterval", help="Interval for Kandler remaining traits sample, taken before maxtime, in generations (will be scaled to timesteps)", default="1000")
    parser.add_argument("--simulationendtime", help="Time at which simulation and sampling end, defaults to 2M steps", default="2000000")

    args = parser.parse_args()

    simconfig = utils.MixtureConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)

    simconfig.num_features = int(args.numloci)
    simconfig.num_traits = int(args.maxinittraits)
    simconfig.popsize = int(args.popsize)
    mut = pg.moran_mutation_rate_from_theta(float(args.popsize), float(args.innovationrate))
    simconfig.innovation_rate = float(args.numloci) * mut
    simconfig.configured_innovation_rate = float(args.innovationrate)
    log.debug("configured theta = %s, using numloci %s * per-locus mutation rate %s = all-loci innovation rate: %s", args.innovationrate, args.numloci, mut, simconfig.innovation_rate)


    simconfig.maxtime = int(args.simulationendtime)
    simconfig.script = __file__
    simconfig.conformism_strength = float(args.conformismstrength)
    simconfig.anticonformism_strength = float(args.anticonformismstrength)
    simconfig.maxtime = int(args.simulationendtime)
    simconfig.model_class_label = simconfig.MODEL_CLASS_LABEL

    log.debug("Equifinality model class: %s", simconfig.model_class_label)


    simconfig.sim_id = uuid.uuid4().urn
    if args.periodic == '1':
        simconfig.periodic = 1
    else:
        simconfig.periodic = 0
开发者ID:benmarwick,项目名称:ctmixtures,代码行数:59,代码来源:sim-ctmixture-timeaveraging.py

示例13: setUp

 def setUp(self):
     ming.configure(**{
             'ming.zarkov.master':'mim:///',
             'ming.zarkov.database':'zarkov'})
     self.options = mock.Mock()
     self.options.journal_file_size = 1024
     self.options.journal_min_files = 4
     self.journal_dir = tempfile.mkdtemp('.journal', 'zarkov-test')
     self.j = JournalWriter(self.options, self.journal_dir, start_greenlets=False)
开发者ID:joeywen,项目名称:zarkov,代码行数:9,代码来源:test_eventlog.py

示例14: test_configure_optional_params

 def test_configure_optional_params(self, Connection):
     ming.configure(**{
             'ming.main.uri':'mongodb://localhost:27017/test_db',
             'ming.main.replicaSet': 'foobar',
             'ming.main.w': 2,
             'ming.main.ssl': True,
             })
     session = Session.by_name('main')
     assert session.bind.conn is not None
     assert session.bind.db is not None
开发者ID:vzhz,项目名称:function_generator,代码行数:10,代码来源:test_datastore.py

示例15: main

def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    import ming

    update_settings_from_environ(settings)
    ming.configure(**settings)
    config = Configurator(settings=settings)
    add_routes(config)
    config.scan()
    return config.make_wsgi_app()
开发者ID:synappio,项目名称:pwcred,代码行数:11,代码来源:main.py


注:本文中的ming.configure函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。