Uploads collection configurations from a specified directory to zookeeper.
968660
def upload_collection_configs(self, collection, fs_path):
        '''
         
        
        '''
        coll_path = fs_path
        if not os.path.isdir(coll_path):
            raise ValueError("{} Doesn't Exist".format(coll_path))
        self._upload_dir(coll_path, '/configs/{}'.format(collection))
1267419
def write_to_directory(self, dataset_info_dir):
    """"""
    # Save the metadata from the features (vocabulary, labels,...)
    if self.features:
      self.features.save_metadata(dataset_info_dir)

    if self.redistribution_info.license:
      with tf.io.gfile.GFile(self._license_filename(dataset_info_dir),
                             "w") as f:
        f.write(self.redistribution_info.license)

    with tf.io.gfile.GFile(self._dataset_info_filename(dataset_info_dir),
                           "w") as f:
      f.write(self.as_json)
249339
@Override
    public T addAsDirectories(final String... paths) throws IllegalArgumentException {
        // Precondition check
        Validate.notNull(paths, "paths must be specified");

        // Represent as array of Paths
        final Collection<ArchivePath> pathsCollection = new ArrayList<ArchivePath>(paths.length);
        for (final String path : paths) {
            pathsCollection.add(ArchivePaths.create(path));
        }

        // Delegate and return
        return this.addAsDirectories(pathsCollection.toArray(new ArchivePath[] {}));
    }
815476
def upload_rabbitmq_conf(template_name=None, context=None, restart=True):
    """"""
    
    template_name = template_name or u'rabbitmq/rabbitmq.config'
    destination = u'/etc/rabbitmq/rabbitmq.config'
    upload_template(template_name, destination, context=context, use_sudo=True)
    if restart:
        restart_service(u'rabbitmq')
1026183
def run_collection(self, conf, rm_conf, branch_info):
        '''
        
        '''
        if rm_conf is None:
            rm_conf = {}
        logger.debug('Beginning to run collection spec...')
        exclude = None
        if rm_conf:
            try:
                exclude = rm_conf['patterns']
                logger.warn("WARNING: Skipping patterns found in remove.conf")
            except LookupError:
                logger.debug('Patterns section of remove.conf is empty.')

        for c in conf['commands']:
            # remember hostname archive path
            if c.get('symbolic_name') == 'hostname':
                self.hostname_path = os.path.join(
                    'insights_commands', mangle.mangle_command(c['command']))
            rm_commands = rm_conf.get('commands', [])
            if c['command'] in rm_commands or c.get('symbolic_name') in rm_commands:
                logger.warn("WARNING: Skipping command %s", c['command'])
            elif self.mountpoint == "/" or c.get("image"):
                cmd_specs = self._parse_command_spec(c, conf['pre_commands'])
                for s in cmd_specs:
                    cmd_spec = InsightsCommand(self.config, s, exclude, self.mountpoint)
                    self.archive.add_to_archive(cmd_spec)
        for f in conf['files']:
            rm_files = rm_conf.get('files', [])
            if f['file'] in rm_files or f.get('symbolic_name') in rm_files:
                logger.warn("WARNING: Skipping file %s", f['file'])
            else:
                file_specs = self._parse_file_spec(f)
                for s in file_specs:
                    # filter files post-wildcard parsing
                    if s['file'] in rm_conf.get('files', []):
                        logger.warn("WARNING: Skipping file %s", s['file'])
                    else:
                        file_spec = InsightsFile(s, exclude, self.mountpoint)
                        self.archive.add_to_archive(file_spec)
        if 'globs' in conf:
            for g in conf['globs']:
                glob_specs = self._parse_glob_spec(g)
                for g in glob_specs:
                    if g['file'] in rm_conf.get('files', []):
                        logger.warn("WARNING: Skipping file %s", g)
                    else:
                        glob_spec = InsightsFile(g, exclude, self.mountpoint)
                        self.archive.add_to_archive(glob_spec)
        logger.debug('Spec collection finished.')

        # collect metadata
        logger.debug('Collecting metadata...')
        self._write_branch_info(branch_info)
        logger.debug('Metadata collection finished.')
785821
def upload(client, source_dir):
    """"""
    print('')
    print('upload store listings')
    print('---------------------')
    listings_folder = os.path.join(source_dir, 'listings')
    langfolders = filter(os.path.isdir, list_dir_abspath(listings_folder))

    for language_dir in langfolders:
        language = os.path.basename(language_dir)
        with open(os.path.join(language_dir, 'listing.json')) as listings_file:
            listing = json.load(listings_file)
        listing_response = client.update(
            'listings', language=language, body=listing)

        print('  Listing for language %s was updated.' %
              listing_response['language'])
7211
def upload(self, *args, **kwargs):
    """"""
    for job in self.jobs:
      job.upload(*args, **kwargs)
1211629
def upload(ctx, check, sdist, dry_run):
    """"""
    if check in get_valid_checks():
        check_dir = os.path.join(get_root(), check)
    else:
        check_dir = resolve_path(check)
        if not dir_exists(check_dir):
            abort('`{}` is not an Agent-based Integration or Python package'.format(check))

        check = basepath(check_dir)

    # retrieve credentials
    pypi_config = ctx.obj.get('pypi', {})
    username = pypi_config.get('user') or os.getenv('TWINE_USERNAME')
    password = pypi_config.get('pass') or os.getenv('TWINE_PASSWORD')
    if not (username and password):
        abort('This requires pypi.user and pypi.pass configuration. Please see `ddev config -h`.')

    auth_env_vars = {'TWINE_USERNAME': username, 'TWINE_PASSWORD': password}
    echo_waiting('Building and publishing `{}` to PyPI...'.format(check))

    with chdir(check_dir, env_vars=auth_env_vars):
        result = build_package(check_dir, sdist)
        if result.code != 0:
            abort(result.stdout, result.code)
        echo_waiting('Uploading the package...')
        if not dry_run:
            result = run_command('twine upload --skip-existing dist{}*'.format(os.path.sep))
            if result.code != 0:
                abort(code=result.code)

    echo_success('Success!')
850061
protected function submitAddCollection()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('collection');
        $this->addCollection();
    }
1257291
public static void updateCatalogToZK(ZooKeeper zk,
                                        int version,
                                        long genId,
                                        byte[] catalogBytes,
                                        byte[] catalogHash,
                                        byte[] deploymentBytes)
        throws KeeperException, InterruptedException
    {
        ByteBuffer versionAndBytes = makeCatalogAndDeploymentBytes(version, genId,
                catalogBytes, catalogHash, deploymentBytes);
        zk.setData(VoltZK.catalogbytes, versionAndBytes.array(), -1);
    }
1343235
void createZKDirectory(String path) {
        try {
            try {
                m_zk.create(path, new byte[0],
                            Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            } catch (KeeperException e) {
                if (e.code() != Code.NODEEXISTS) {
                    throw e;
                }
            }
        } catch (Exception e) {
            VoltDB.crashGlobalVoltDB("Failed to create Zookeeper node: " + e.getMessage(),
                                     false, e);
        }
    }
853517
def setup_directories(builddir):
    """"""
    build_dir = local.path(builddir)
    in_dir = build_dir / "container-in"
    out_dir = build_dir / "container-out"

    if not in_dir.exists():
        in_dir.mkdir()
    if not out_dir.exists():
        out_dir.mkdir()
889561
function createCollection(dirPrefix, dirPath, dirConfigs) {
    const dir = dirPath.shift();
    const dirConfig = dirConfigs.shift() || {};
    const absDir = path.join(dirPrefix, dir);

    // Create the collection directory
    try {
        if (!fs.statSync(absDir).isDirectory()) {
            throw new Error('1');
        }
    } catch (e) {
        try {
            if (!mkdirp(absDir)) {
                throw new Error('2');
            }
        } catch (f) {
            return false;
        }
    }

    // Configure the collection prefix
    const configPath = path.join(absDir, `${dir.replace(/^\d{2}-/, '')}.config.json`);
    const prefix = path.relative(app.components.get('path'), absDir).split(path.sep).map(p => p.replace(/^\d{2}-/, '')).join('-');

    let config;
    try {
        config = require(configPath);
        config.prefix = prefix;
    } catch (e) {
        config = { prefix };
    }
    ['label'].forEach(c => {
        if (c in dirConfig) {
            config[c] = dirConfig[c];
        }
    })
    writeFile(configPath, JSON.stringify(config, null, 4));

    // Recurse
    return dirPath.length ? createCollection(absDir, dirPath, dirConfigs) : true;
}
1107511
def addList(self, source_id, dir_path, is_recurcive=False, timestamp_reception=None, training_metadata=[]):
        """"""
        if not path.isdir(dir_path):
            raise ValueError(dir_path + ' is not a directory')
        files_to_send = _get_files_from_dir(dir_path, is_recurcive)
        succeed_upload = {}
        failed_upload = {}
        for file_path in files_to_send:
            try:
                resp = self.add(source_id=source_id,
                    file_path=file_path, profile_reference="",
                    timestamp_reception=timestamp_reception, training_metadata=training_metadata)
                if resp['code'] != 200 and resp['code'] != 201:
                    failed_upload[file_path] = ValueError('Invalid response: ' + str(resp))
                else:
                    succeed_upload[file_path] = resp
            except BaseException as e:
                failed_upload[file_path] = e
        result = {
            'success': succeed_upload,
            'fail': failed_upload
        }
        return result
1024176
protected function initializeCollections()
    {
        foreach ($this->settings['collections'] as $collectionName => $collectionDefinition) {
            if (!isset($collectionDefinition['storage'])) {
                throw new Exception(sprintf('The configuration for the resource collection "%s" defined in your settings has no valid "storage" option. Please check the configuration syntax.', $collectionName), 1361468805);
            }
            if (!isset($this->storages[$collectionDefinition['storage']])) {
                throw new Exception(sprintf('The configuration for the resource collection "%s" defined in your settings referred to a non-existing storage "%s". Please check the configuration syntax and make sure to specify a valid storage class name.', $collectionName, $collectionDefinition['storage']), 1361481031);
            }
            if (!isset($collectionDefinition['target'])) {
                throw new Exception(sprintf('The configuration for the resource collection "%s" defined in your settings has no valid "target" option. Please check the configuration syntax and make sure to specify a valid target class name.', $collectionName), 1361468923);
            }
            if (!isset($this->targets[$collectionDefinition['target']])) {
                throw new Exception(sprintf('The configuration for the resource collection "%s" defined in your settings has not defined a valid "target" option. Please check the configuration syntax and make sure that the specified class "%s" really exists.', $collectionName, $collectionDefinition['target']), 1361468924);
            }

            $pathPatterns = (isset($collectionDefinition['pathPatterns'])) ? $collectionDefinition['pathPatterns'] : [];
            $filenames = (isset($collectionDefinition['filenames'])) ? $collectionDefinition['filenames'] : [];

            $this->collections[$collectionName] = new Collection($collectionName, $this->storages[$collectionDefinition['storage']], $this->targets[$collectionDefinition['target']], $pathPatterns, $filenames);
        }
    }
693815
def load_collection_from_file(resource, filename, content_type=None):
    
    coll = create_staging_collection(resource)
    load_into_collection_from_file(coll, filename,
                                   content_type=content_type)
    return coll
849135
public static CuratorFramework newRootFluoCurator(FluoConfiguration config) {
    return newCurator(ZookeeperUtil.parseServers(config.getInstanceZookeepers()),
        config.getZookeeperTimeout(), config.getZookeeperSecret());
  }