Create a new RADOS pool.
509698
def create_pool(service, name, replicas=3, pg_num=None):
    """"""
    if pool_exists(service, name):
        log("Ceph pool {} already exists, skipping creation".format(name),
            level=WARNING)
        return

    if not pg_num:
        # Calculate the number of placement groups based
        # on upstream recommended best practices.
        osds = get_osds(service)
        if osds:
            pg_num = (len(osds) * 100 // replicas)
        else:
            # NOTE(james-page): Default to 200 for older ceph versions
            # which don't support OSD query from cli
            pg_num = 200

    cmd = ['ceph', '--id', service, 'osd', 'pool', 'create', name, str(pg_num)]
    check_call(cmd)

    update_pool(service, name, settings={'size': str(replicas)})
390791
def _create(self):
        """"""
        listDirs = []
        parent = self
        while parent:
            if parent.exists():
                break
            listDirs.append(parent)
            p = parent.up()
            if p is None:
                # Don't use while: - else: for this condition because
                # if so, then parent is None and has no .path attribute.
                raise SCons.Errors.StopError(parent._path)
            parent = p
        listDirs.reverse()
        for dirnode in listDirs:
            try:
                # Don't call dirnode.build(), call the base Node method
                # directly because we definitely *must* create this
                # directory.  The dirnode.build() method will suppress
                # the build if it's the default builder.
                SCons.Node.Node.build(dirnode)
                dirnode.get_executor().nullify()
                # The build() action may or may not have actually
                # created the directory, depending on whether the -n
                # option was used or not.  Delete the _exists and
                # _rexists attributes so they can be reevaluated.
                dirnode.clear()
            except OSError:
                pass
1038880
async def init(self, *args, dialect=None, **kwargs):
        
        self.__pool = await create_pool(*args, dialect=dialect, **kwargs)
1372585
def _repopulate_pool(self):
        
        for i in range(self._processes - len(self._pool)):
            w = self.Process(target=self._worker_f,
                             args=(self._inqueue, self._outqueue,
                                   self._initializer,
                                   self._initargs, self._maxtasksperchild))
            self._pool.append(w)
            w.name = w.name.replace('Process', 'PoolWorker')
            w.daemon = True
            w.start()
            debug('added worker')
1362406
public static ThreadPoolExecutor newExecutor(int corePoolSize, int maximumPoolSize) {
		return ExecutorBuilder.create().setCorePoolSize(corePoolSize).setMaxPoolSize(maximumPoolSize).build();
	}
1014927
def new_worker_pool(self, name: str, min_workers: int = 0, max_workers: int = 1,
                        max_seconds_idle: int = DEFAULT_WORKER_POOL_MAX_SECONDS_IDLE):
        
        if not self.running:
            return self.immediate_worker
        worker = self._new_worker_pool(name, min_workers, max_workers, max_seconds_idle)
        self._start_worker_pool(worker)
        return worker
297616
def Pool(pool='AnyPool', **kwargs):
    '''
    

    '''

    if pool == 'MPIPool':
        return MPIPool(**kwargs)
    elif pool == 'MultiPool':
        return MultiPool(**kwargs)
    elif pool == 'SerialPool':
        return SerialPool(**kwargs)
    elif pool == 'AnyPool':
        if MPIPool.enabled():
            return MPIPool(**kwargs)
        elif MultiPool.enabled():
            return MultiPool(**kwargs)
        else:
            return SerialPool(**kwargs)
    else:
        raise ValueError('Invalid pool ``%s``.' % pool)
587034
function RedisPool(opts) {

    if (!(this instanceof RedisPool)) {
        return new RedisPool(opts);
    }

    EventEmitter.call(this);

    opts = opts || {};
    var defaults = {
        host: '127.0.0.1',
        port: '6379',
        max: 50,
        idleTimeoutMillis: 10000,
        reapIntervalMillis: 1000,
        noReadyCheck: false,
        returnToHead: false,
        unwatchOnRelease: true,
        name: 'default',
        log: false,
        slowPool: {
            log: false,
            elapsedThreshold: 25
        },
        emitter: {
            statusInterval: 60000
        },
        commands: []
    };

    this.options = _.defaults(opts, defaults);
    this.pools = {};
    this.elapsedThreshold = this.options.slowPool.elapsedThreshold;

    // add custom Redis commands
    if (this.options.commands && this.options.commands.length) {
        this.options.commands.forEach(function(newCommand) {
            redis.add_command(newCommand);
        });
    }

    var self = this;
    setInterval(function() {
        Object.keys(self.pools).forEach(function(poolKey) {
            var pool = self.pools[poolKey];
            self.emit('status', {
                name: self.options.name,
                db: poolKey,
                count: pool.getPoolSize(),
                unused: pool.availableObjectsCount(),
                waiting:  pool.waitingClientsCount()
            });
        });
    }, this.options.emitter.statusInterval);
}
866410
def create(size=nil)
      if Rudy::Huxtable.global.position.nil?
        size ||= current_machine_count.to_i || 1
        group = Array.new(size) do |i|
          m = Rudy::Machine.new(i + 1)
          m.create
          li "Created: #{m.to_s}"
          m
        end
      else
        m = Rudy::Machine.new(Rudy::Huxtable.global.position)
        m.create
        li "Created: #{m.to_s}"
        group = [m]
      end
      group
    end
962416
def new(conf):
    """"""

    algorithm = conf.get("algorithm")
    salt = conf.get("salt").encode("utf-8")

    if algorithm == "none":
        return Hash(salt, None)
    elif algorithm.startswith("pbkdf2"):
        kwargs = {}
        tail = algorithm.partition(":")[2]
        for func, key in ((int, "iterations"), (int, "dklen"), (str, "func")):
            head, _, tail = tail.partition(":")
            if not head:
                break
            kwargs[key] = func(head)

        return PBKDF2(salt, **kwargs)
    else:
        return Hash(salt, algorithm)
592162
def new_(self, df=pd.DataFrame(), db=None, quiet=False,
             nbload_libs=True):
        
        ds2 = Ds(df, db, nbload_libs)
        if quiet is False:
            self.ok("A new instance was created")
        return ds2
287269
def create(self):
        
        # Calls each of these methods in order.  _populate_from_lines and
        # _update_relations must be implemented in subclasses.
        self._init_tables()
        self._populate_from_lines(self.iterator)
        self._update_relations()
        self._finalize()
1118149
def create_table(clas,pool_or_cursor):
    ""
    def mkfield((name,tp)): return name,(tp if isinstance(tp,basestring) else 'jsonb')
    fields = ','.join(map(' '.join,map(mkfield,clas.FIELDS)))
    base = 'create table if not exists %s (%s'%(clas.TABLE,fields)
    if clas.PKEY: base += ',primary key (%s)'%clas.PKEY
    base += ')'
    commit_or_execute(pool_or_cursor,base)
    clas.create_indexes(pool_or_cursor)
366006
def create_producer(self):
        """"""
        with self.connection_pool.acquire(block=True) as conn:
            yield self.producer(conn)
116030
def new(self, *args, **kwargs):
        '''
'''
        return self.session().add(self.model(*args, **kwargs))
1327619
def _ensure_pool_exists(self):
        """"""
        if self.pid not in self._pool_manager:
            self._pool_manager.create(self.pid, self._pool_idle_ttl,
                                      self._pool_max_size, self._ioloop.time)
949727
def update_pool(self, pool, body=None):
        """"""
        return self.put(self.pool_path % (pool), body=body)