Examples of JobExecutionResult


Examples of org.apache.flink.api.common.JobExecutionResult

        throw new ProgramInvocationException("The program has been canceled");
      } else {
        throw new ProgramInvocationException("The program execution failed: " + jex.getMessage());
      }
    }
    return new JobExecutionResult(-1, null);
  }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

   */
  public static void main(String[] args) throws Exception {

    prepareTestDb();
    JDBCExample tut = new JDBCExample();
    JobExecutionResult res = LocalExecutor.execute(tut, args);
    System.out.println("runtime: " + res.getNetRuntime());

    System.exit(0);
  }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

      System.exit(1);
    }

    Plan plan = wc.getPlan(args);

    JobExecutionResult result = LocalExecutor.execute(plan);

    // Accumulators can be accessed by their name.
    System.out.println("Number of lines counter: "+ result.getAccumulatorResult(TokenizeLine.ACCUM_NUM_LINES));
    System.out.println("Words per line histogram: " + result.getAccumulatorResult(TokenizeLine.ACCUM_WORDS_PER_LINE));
    System.out.println("Distinct words: " + result.getAccumulatorResult(TokenizeLine.ACCUM_DISTINCT_WORDS));
  }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

   
    Plan plan = wc.getPlan(args);
   
    // This will execute the word-count embedded in a local context. replace this line by the commented
    // succeeding line to send the job to a local installation or to a cluster for execution
    JobExecutionResult result = LocalExecutor.execute(plan);
    System.err.println("Total runtime: " + result.getNetRuntime());
  }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

  protected void postSubmit() throws Exception {
    compareResultsByLinesInMemory(EXPECTED, resultPath);
   
    // Test accumulator results
    System.out.println("Accumulator results:");
    JobExecutionResult res = this.result;
    System.out.println(AccumulatorHelper.getResultsFormated(res.getAllAccumulatorResults()));
   
    Assert.assertEquals(new Integer(3), (Integer) res.getAccumulatorResult("num-lines"));

    Assert.assertEquals(new Double(getDegreeOfParallelism()), (Double)res.getAccumulatorResult("open-close-counter"));
   
    // Test histogram (words per line distribution)
    Map<Integer, Integer> dist = Maps.newHashMap();
    dist.put(1, 1); dist.put(2, 1); dist.put(3, 1);
    Assert.assertEquals(dist, res.getAccumulatorResult("words-per-line"));
   
    // Test distinct words (custom accumulator)
    Set<StringValue> distinctWords = Sets.newHashSet();
    distinctWords.add(new StringValue("one"));
    distinctWords.add(new StringValue("two"));
    distinctWords.add(new StringValue("three"));
    Assert.assertEquals(distinctWords, res.getAccumulatorResult("distinct-words"));
  }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

     
      env.generateSequence(1, NUM_ELEMENTS)
        .map(new CountingMapper())
        .output(new DiscardingOuputFormat<Long>());
     
      JobExecutionResult result = env.execute();
     
      assertTrue(result.getNetRuntime() >= 0);
     
      assertEquals(NUM_ELEMENTS, result.getAccumulatorResult(ACCUMULATOR_NAME));
    }
    catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

    } else {
      filteredLines.writeAsCsv(outputPath);
    }

    // execute program
    final JobExecutionResult result = env.execute("Accumulator example");

    // get the accumulator result via its registration key
    final List<Integer> emptyFields = result.getAccumulatorResult(EMPTY_FIELD_ACCUMULATOR);
    System.out.format("Number of detected empty fields per column: %s\n", emptyFields);

  }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

        NepheleJobGraphGenerator jgg = new NepheleJobGraphGenerator();
        JobGraph jobGraph = jgg.compileJobGraph(op);

        JobClient client = this.executor.getJobClient(jobGraph);
        client.setConsoleStreamForReporting(AbstractTestBase.getNullPrintStream());
        JobExecutionResult result = client.submitJobAndWait();
       
        this.latestResult = result;
        return result;
      }
      catch (Exception e) {
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

      return execute("test job");
    }
   
    @Override
    public JobExecutionResult execute(String jobName) throws Exception {
      JobExecutionResult result = super.execute(jobName);
      this.latestResult = result;
      return result;
    }
View Full Code Here

Examples of org.apache.flink.api.common.JobExecutionResult

      execute(sink);
    }
   
    long endTime = System.currentTimeMillis();
    Map<String, Object> accumulatorResults = AccumulatorHelper.toResultMap(accumulators);
    return new JobExecutionResult(endTime - startTime, accumulatorResults);
  }
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.