Package org.apache.flink.api.common

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


              accumulators = AccumulatorHelper.toResultMap(getAccumulators().getAccumulators(this.userCodeClassLoader));
            } catch (IOException ioe) {
              Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
              throw ioe; // Rethrow error
            }
            return new JobExecutionResult(jobDuration, accumulators);

          } else if (jobStatus == JobStatus.CANCELED || jobStatus == JobStatus.FAILED) {
            Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
            LOG.info(jobEvent.getOptionalMessage());
            if (jobStatus == JobStatus.CANCELED) {
View Full Code Here


        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

   */
  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

      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

   
    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

  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

     
      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

    } 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

        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

      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

TOP

Related Classes of org.apache.flink.api.common.JobExecutionResult

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.