Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileSystem.create()


          }
        }
      } catch (FileNotFoundException fnf) {
        // Lock file does not exist; try creating it ourselves
        try {
          FSDataOutputStream out = fs.create(lockPath, false);
          out.close();
          fs.setTimes(lockPath, -1, System.currentTimeMillis());
          // If we got here, we created the lock file successfully; go ahead
          // and launch the JobTracker
          Random r = new Random();
View Full Code Here


   
    // check if the second job is successful
    assertTrue(dJob.isSuccessful());

    // signal the cleanup
    fs.create(share).close();
   
    while (true) {
      LOG.info("Waiting for job " + runningJob.getID() + " to complete");
      try {
        Thread.sleep(100);
View Full Code Here

  private static void writeLocalTaskFile(String jobFile, JobConf conf)
      throws IOException {
    Path localTaskFile = new Path(jobFile);
    FileSystem localFs = FileSystem.getLocal(conf);
    localFs.delete(localTaskFile, true);
    OutputStream out = localFs.create(localTaskFile);
    try {
      conf.writeXml(out);
    } finally {
      out.close();
    }
View Full Code Here

        Configuration conf=new Configuration();
        HadoopBaseUtils.grabConfiguration(hdpConf, conf)
        conf.setInt("dfs.replication", maxReplicaton);
          FileSystem fs = FileSystem.get(conf);
          IndexUtils.truncate(fs, new Path(upFolder));
         FSDataOutputStream output= fs.create( new Path(upFolder),true);   
        for(String s : listStrs){
          if(s!=null && !s.equals(""))
            output.write(new String(s+"\n").getBytes());
        }               
        output.close();
View Full Code Here

        String hdpConf=(String) stormconf.get("hadoop.conf.dir");
        Configuration conf=new Configuration();
        HadoopBaseUtils.grabConfiguration(hdpConf, conf)
          FileSystem fs = FileSystem.get(conf);
          IndexUtils.truncate(fs, new Path(upFolder));
         FSDataOutputStream output= fs.create( new Path(upFolder),true);   
        for(String s : listStrs){
          if(s!=null && !s.equals(""))
            output.write(new String(s+"\n").getBytes());
        }               
        output.close();
View Full Code Here

      this.makePath(filepath, conf);

      Path randompath = new Path(this.file + "_" + java.util.UUID.randomUUID().toString());
      try {
        FSDataOutputStream writer = fs.create(randompath);

        Reader reader = stream.getReader();
        if (!(reader instanceof BufferedReader)) {
          reader = new BufferedReader(reader);
        }
View Full Code Here

      fs.mkdirs(new Path(store));
    }
   
    HashMap<String,String> params=new HashMap<String, String>();
    Path outpath=new Path(store,String.valueOf(System.currentTimeMillis()));
    FSDataOutputStream out=fs.create(outpath);
      OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8");

    Upload up=new Upload();
    up.mergerTo(request, response, "gbk", osw, params);
    osw.close();
View Full Code Here

    {
      fs.mkdirs(new Path(store));
    }
   
    HashMap<String,String> params=new HashMap<String, String>();
    FSDataOutputStream out=fs.create(new Path(store,String.valueOf(System.currentTimeMillis())));
      OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8");

    Upload up=new Upload();
    up.mergerTo(request, response, "gbk", osw, params);
    osw.close();
View Full Code Here

    }
    fs.mkdirs(tmpDir);
   
    Path tsdst=new Path(tmpDir,"realtime_ts");
   
    OutputStreamWriter fwriterTs= new OutputStreamWriter(fs.create(tsdst));
    fwriterTs.write(tsstr);
    fwriterTs.close();
    LOG.info("####sync realtime_ts ####"+tsstr+","+tsdst.toString());
   
    long txid=0;
View Full Code Here

    }
    fs.mkdirs(tmpDir);
   
    Path tsdst=new Path(tmpDir,"realtime_ts");
   
    OutputStreamWriter fwriterTs= new OutputStreamWriter(fs.create(tsdst));
    fwriterTs.write(tsstr);
    fwriterTs.close();
    LOG.info("####sync realtime_ts ####"+tsstr+","+tsdst.toString());
   
    long txid=0;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.