Package org.apache.flink.api.common.cache.DistributedCache

Examples of org.apache.flink.api.common.cache.DistributedCache.DistributedCacheEntry


   * @param filePath The path of the file, as a URI (e.g. "file:///some/path" or "hdfs://host:port/and/path")
   * @param name The name under which the file is registered.
   * @param executable flag indicating whether the file should be executable
   */
  public void registerCachedFile(String filePath, String name, boolean executable){
    this.cacheFile.add(new Tuple2<String, DistributedCacheEntry>(name, new DistributedCacheEntry(filePath, executable)));
  }
View Full Code Here


  @Override
  protected Plan getTestJob() {
    Plan plan =  getPlan(1 , textPath, resultPath);
    try {
      plan.registerCachedFile("cache_test", new DistributedCacheEntry(cachePath, false));
    } catch (IOException ex) {
      throw new RuntimeException(ex);
    }   
    return plan;
  }
View Full Code Here

        if (!u.getPath().startsWith("/")) {
          u = new File(entry.filePath).toURI();
        }
        FileSystem fs = FileSystem.get(u);
        if (fs.exists(new Path(u.getPath()))) {
          this.cacheFile.put(name, new DistributedCacheEntry(u.toString(), entry.isExecutable));
        } else {
          throw new IOException("File " + u.toString() + " doesn't exist.");
        }
      } catch (URISyntaxException ex) {
        throw new IOException("Invalid path: " + entry.filePath, ex);
View Full Code Here

  @Test
  public void testFileReuseForNextTask() {
    JobID jobID = new JobID();
    String filePath = f.toURI().toString();
    fileCache.createTmpFile("test_file", new DistributedCacheEntry(filePath, false), jobID);
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      throw new RuntimeException("Interrupted error", e);
    }
    fileCache.deleteTmpFile("test_file", new DistributedCacheEntry(filePath, false), jobID);
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      throw new RuntimeException("Interrupted error", e);
    }
    //new task comes after 1 second
    try {
      Assert.assertTrue("Local cache file should not be deleted when another task comes in 5 seconds!", lfs.exists(fileCache.getTempDir(jobID, "cacheFile")));
    } catch (IOException e) {
      throw new RuntimeException("Interrupted error", e);
    }
    fileCache.createTmpFile("test_file", new DistributedCacheEntry(filePath, false), jobID);
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      throw new RuntimeException("Interrupted error", e);
    }
    fileCache.deleteTmpFile("test_file", new DistributedCacheEntry(filePath, false), jobID);
    try {
      Thread.sleep(7000);
    } catch (InterruptedException e) {
      throw new RuntimeException("Interrupted error", e);
    }
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.cache.DistributedCache.DistributedCacheEntry

Copyright © 2018 www.massapicom. 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.