/* Initialize a Raid FileSystem
510726
public void initialize(URI name, Configuration conf) throws IOException {
    this.conf = conf;
    
    // init the codec from conf.
    Codec.initializeCodecs(conf);

    Class<?> clazz = conf.getClass("fs.raid.underlyingfs.impl",
        DistributedFileSystem.class);
    if (clazz == null) {
      throw new IOException("No FileSystem for fs.raid.underlyingfs.impl.");
    }
    
    String ignoredDirectories = conf.get(DIRECTORIES_IGNORE_PARITY_CHECKING_KEY);
    if (ignoredDirectories != null && ignoredDirectories.length() > 0) {
      String[] directories = ignoredDirectories.split(",");
      directoriesIgnoreCheckParity = new ArrayList<String>();
      for (String dir : directories) {
        if (dir.length() > 0 && dir.startsWith("/")) {
          if (!dir.endsWith("/")) {
            dir = dir + "/";
          }
          directoriesIgnoreCheckParity.add(dir);
        }
      }
    }

    this.fs = (FileSystem)ReflectionUtils.newInstance(clazz, null); 
    super.initialize(name, conf);
  }
861614
@Override
    public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException
    {
        FileSplit split = (FileSplit) genericSplit;
        Configuration job = context.getConfiguration();
        start = split.getStart();
        end = start + split.getLength();
        final Path file = split.getPath();

        // Open the file and seek to the start of the split
        FileSystem fs = file.getFileSystem(job);
        fileIn = fs.open(split.getPath());
        if (start != 0) {
            --start;
            fileIn.seek(start);
        }

        this.pos = start;
        deserializer = new SmileEnvelopeEventDeserializer(fileIn, false);
    }
106132
def initializenb():
    

    logger.info('Working directory: {0}'.format(os.getcwd()))
    logger.info('Run on {0}'.format(asctime()))
    try:
        fileroot = os.environ['fileroot']
        logger.info('Setting fileroot to {0} from environment variable.\n'.format(fileroot))
        candsfile = 'cands_{0}_merge.pkl'.format(fileroot)
        noisefile = 'noise_{0}_merge.pkl'.format(fileroot)
    except KeyError:
        sdmdir = os.getcwd()
        logger.info('Setting sdmdir to current directory {0}\n'.format(os.path.abspath(sdmdir)))
        candsfiles = glob.glob('cands_*_merge.pkl')
        noisefiles = glob.glob('noise_*_merge.pkl')
        if len(candsfiles) == 1 and len(noisefiles) == 1:
            logger.info('Found one cands/merge file set')
        else:
            logger.warn('Found multiple cands/noise file sets. Taking first.')

        candsfile = candsfiles[0]
        noisefile = noisefiles[0]
        fileroot = candsfile.rstrip('_merge.pkl').lstrip('cands_')
    logger.info('Set: \n\t candsfile {} \n\t noisefile {} \n\t fileroot {} '.format(candsfile, noisefile, fileroot))
    return (candsfile, noisefile, fileroot)
531762
public static RaidNode createRaidNode(String argv[], Configuration conf)
      throws IOException, ClassNotFoundException {
    if (conf == null) {
      conf = new Configuration();
    }
    StartupOption startOpt = parseArguments(argv);
    if (startOpt == null) {
      printUsage();
      return null;
    }
    setStartupOption(conf, startOpt);
    RaidNode node = createRaidNode(conf);
    return node;
  }
192744
@Override
  public INodeRaidStorage convertToRaidStorage(BlockInfo[] parityBlocks, 
      RaidCodec codec, int[] checksums, BlocksMap blocksMap, short replication,
      INodeFile inode) throws IOException {
    if (codec == null) {
      throw new IOException("Codec is null");
    } else {
      return new INodeRaidStorage(codec.convertToRaidStorage(parityBlocks,
          blocks, checksums, blocksMap, replication, inode), codec);
    }
  }
435167
def initialize(self):
        """"""
        if self.collname not in self.current_kv_names():
            r = self.request('post',
                             self.url+"storage/collections/config",
                             headers={'content-type': 'application/json'},
                             data={'name': self.collname})
            r.raise_for_status()
        # initialize schema
        re = self.request('post',
                          self.url+"storage/collections/config/"+self.collname,
                          headers = {'content-type': 'application/json'},
                          data=self.schema)
        re.raise_for_status()
        logger.info("initialized Splunk Key Value Collection %s with schema %s"\
                        % (self.collname, str(self.schema)))
        if self.collname not in self.current_kv_names():
            raise EnvironmentError('expected %s in list of kv collections %s' % (self.collname, str(self.current_kv_names())))
290907
private void init() {
        logger.info("metadata init().");

        writeLock.lock();
        try {
        // Required keys
        initCache(CLUSTER_KEY);

        // If stores definition storage engine is not null, initialize metadata
        // Add the mapping from key to the storage engine used
        if(this.storeDefinitionsStorageEngine != null) {
            initStoreDefinitions(null);
        } else {
            initCache(STORES_KEY);
        }

        // Initialize system store in the metadata cache
        initSystemCache();
        initSystemRoutingStrategies(getCluster());

        // Initialize with default if not present
        initCache(SLOP_STREAMING_ENABLED_KEY, true);
        initCache(PARTITION_STREAMING_ENABLED_KEY, true);
        initCache(READONLY_FETCH_ENABLED_KEY, true);
        initCache(QUOTA_ENFORCEMENT_ENABLED_KEY, true);
        initCache(REBALANCING_STEAL_INFO, new RebalancerState(new ArrayList<RebalanceTaskInfo>()));
        initCache(SERVER_STATE_KEY, VoldemortState.NORMAL_SERVER.toString());
        initCache(REBALANCING_SOURCE_CLUSTER_XML, null);
        initCache(REBALANCING_SOURCE_STORES_XML, null);


        } finally {
            writeLock.unlock();
        }
    }
599102
def make_filesystem(blk_device, fstype='ext4', timeout=10):
    """"""
    count = 0
    e_noent = os.errno.ENOENT
    while not os.path.exists(blk_device):
        if count >= timeout:
            log('Gave up waiting on block device %s' % blk_device,
                level=ERROR)
            raise IOError(e_noent, os.strerror(e_noent), blk_device)

        log('Waiting for block device %s to appear' % blk_device,
            level=DEBUG)
        count += 1
        time.sleep(1)
    else:
        log('Formatting block device %s as filesystem %s.' %
            (blk_device, fstype), level=INFO)
        check_call(['mkfs', '-t', fstype, blk_device])
760459
static void addCodec(RaidCodec codec) {
    List<RaidCodec> newCodecs = new ArrayList<RaidCodec>();
    newCodecs.addAll(codecs);
    newCodecs.add(codec);
    codecs = Collections.unmodifiableList(newCodecs);

    Map<String, RaidCodec> newIdToCodec = new HashMap<String, RaidCodec>();
    newIdToCodec.putAll(idToCodec);
    newIdToCodec.put(codec.id, codec);
    idToCodec = Collections.unmodifiableMap(newIdToCodec);
  }
1190581
function initTernServer(dir, files) {
            initTernModule();
            numResolvedFiles = 0;
            numAddedFiles = 0;
            stopAddingFiles = false;
            numInitialFiles = files.length;

            ternPromise.done(function (ternModule) {
                var msg = {
                    type        : MessageIds.TERN_INIT_MSG,
                    dir         : dir,
                    files       : files,
                    env         : ternEnvironment,
                    timeout     : PreferencesManager.get("jscodehints.inferenceTimeout")
                };
                _ternNodeDomain.exec("invokeTernCommand", msg);
            });
            rootTernDir = dir + "/";
        }
490859
def initialize(self):
        """"""
        mkdir_p(self.archive_path)
        mkdir_p(self.bin_path)
        mkdir_p(self.codebase_path)
        mkdir_p(self.input_basepath)
399329
private static void initialize(Storage storage, String counterId) {
    LOG.debug("Initializing counter shards for resource {}", counterId);
    for (int startIndex = 0; startIndex < NUM_SHARDS; startIndex += TRANSACTION_GROUP_SIZE) {
      initShardRange(storage, counterId, startIndex,
                     Math.min(NUM_SHARDS, startIndex + TRANSACTION_GROUP_SIZE));
    }
  }
107344
private void init(FileChannel channel, FileChannel.MapMode mapMode)
    throws IOException {
        
        this.channel = channel;
        this.mappedByteBuffer = channel.map(mapMode, 0L, channel.size());
        mappedByteBuffer.load();
    }
901987
@Override
    public synchronized void initialize() {
        if (!mRootDirectory.exists()) {
            if (!mRootDirectory.mkdirs()) {
                //silently ignoring no cache is not good so we throw and let the user decide
                // what
                // to do
                throw new IllegalStateException("Unable to create cache dir: " + mRootDirectory
                        .getAbsolutePath());
            }
            //we have an empty cache so we just return
            return;
        }

        File[] files = mRootDirectory.listFiles();
        if (files == null) {
            return;
        }
        for (File file : files) {
            BufferedInputStream fis = null;
            try {
                fis = new BufferedInputStream(new FileInputStream(file));
                CacheHeader entry = CacheHeader.readHeader(fis);
                entry.size = file.length();
                putEntry(entry.key, entry);
            } catch (IOException e) {
                if (file != null) {
                    file.delete();
                }
            } finally {
                try {
                    if (fis != null) {
                        fis.close();
                    }
                } catch (IOException ignored) {
                }
            }
        }
    }
322991
@Override
    public void init(ServletConfig config) throws ServletException {
        LOGGER.info("Initializing filesystem resource servlet");
        super.init(config);

        final String directory = config.getInitParameter("directory");
        if (StringUtils.isNotBlank(directory)) {
            this.directory = directory;
        }

        final String absolute = config.getInitParameter("absolute");
        if (StringUtils.isNotBlank(absolute)) {
            this.absolute = BooleanUtil.valueOf(absolute);
        }
    }
906930
def initialize(dirs):
    
    if biolite and dirs.get("work"):
        base_dir = utils.safe_makedir(os.path.join(dirs["work"], "provenance"))
        p_db = os.path.join(base_dir, "biolite.db")
        biolite.config.resources["database"] = p_db
        biolite.database.connect()
67894
def _initDiskStats(self):
        """"""
        self._diskStats = {}
        self._mapMajorMinor2dev = {}
        try:
            fp = open(diskStatsFile, 'r')
            data = fp.read()
            fp.close()
        except:
            raise IOError('Failed reading disk stats from file: %s'
                          % diskStatsFile)
        for line in data.splitlines():
            cols = line.split()
            dev = cols.pop(2)
            if len(cols) == 13:
                self._diskStats[dev] = dict(zip(
                    ('major', 'minor',
                     'rios', 'rmerges', 'rsect', 'rticks',
                     'wios', 'wmerges', 'wsect', 'wticks',
                     'ios_active', 'totticks', 'rqticks'),
                    [int(x) for x in cols]))
            elif len(cols) == 6:
                self._diskStats[dev] = dict(zip(
                    ('major', 'minor',
                     'rios', 'rsect',
                     'wios', 'wsect'),
                    [int(x) for x in cols]))
            else:
                continue
            self._diskStats[dev]['rbytes'] = (
                self._diskStats[dev]['rsect'] * sectorSize)
            self._diskStats[dev]['wbytes'] = (
                self._diskStats[dev]['wsect'] * sectorSize)
            self._mapMajorMinor2dev[(int(cols[0]), int(cols[1]))] = dev