Package org.apache.flink.runtime.client

Examples of org.apache.flink.runtime.client.JobClient


    JobGraph job = getJobGraph(compiledPlan, libraries);
    return run(job, wait);
  }

  public JobExecutionResult run(JobGraph jobGraph, boolean wait) throws ProgramInvocationException {
    JobClient client;
    try {
      client = new JobClient(jobGraph, configuration, this.userCodeClassLoader);
    }
    catch (IOException e) {
      throw new ProgramInvocationException("Could not open job manager: " + e.getMessage());
    }
   
    client.setConsoleStreamForReporting(this.printStatusDuringExecution ? System.out : null);

    try {
      if (wait) {
        return client.submitJobAndWait();
      }
      else {
        JobSubmissionResult result = client.submitJob();
       
        if (result.getReturnCode() != ReturnCode.SUCCESS) {
          throw new ProgramInvocationException("The job was not successfully submitted to the nephele job manager"
            + (result.getDescription() == null ? "." : ": " + result.getDescription()));
        }
View Full Code Here


  private JobGraphUtils() {}
 

  public static void submit(JobGraph graph, Configuration nepheleConfig) throws IOException, JobExecutionException {
    JobClient client = new JobClient(graph, nepheleConfig, JobGraphUtils.class.getClassLoader());
    client.submitJobAndWait();
  }
View Full Code Here

     */
    @Override
    public void run() {
      try {
        // submit failing job
        JobClient client = this.executor.getJobClient(this.failingJob);
        client.setConsoleStreamForReporting(AbstractTestBase.getNullPrintStream());
        client.submitJobAndWait();
       
        this.error = new Exception("The job did not fail.");
      } catch(JobExecutionException jee) {
        // as expected
      } catch (Exception e) {
        this.error = e;
      }
     
     
      try {
        // submit working job
        JobClient client = this.executor.getJobClient(this.job);
        client.setConsoleStreamForReporting(AbstractTestBase.getNullPrintStream());
        client.submitJobAndWait();
      } catch (Exception e) {
        this.error = e;
      }
     
      // interrupt timeout thread
View Full Code Here

      // submit job
      final JobGraph jobGraph = getJobGraph(plan);

      final long startingTime = System.currentTimeMillis();
      long cancelTime = -1L;
      final JobClient client = this.executor.getJobClient(jobGraph);
      final JobSubmissionResult submissionResult = client.submitJob();
      if (submissionResult.getReturnCode() != AbstractJobResult.ReturnCode.SUCCESS) {
        throw new IllegalStateException(submissionResult.getDescription());
      }

      final int interval = client.getRecommendedPollingInterval();
      final long sleep = interval * 1000L;

      Thread.sleep(sleep / 2);

      long lastProcessedEventSequenceNumber = -1L;

      while (true) {

        if (Thread.interrupted()) {
          throw new IllegalStateException("Job client has been interrupted");
        }

        final long now = System.currentTimeMillis();

        if (cancelTime < 0L) {

          // Cancel job
          if (startingTime + msecsTillCanceling < now) {

            LOG.info("Issuing cancel request");

            final JobCancelResult jcr = client.cancelJob();

            if (jcr == null) {
              throw new IllegalStateException("Return value of cancelJob is null!");
            }

            if (jcr.getReturnCode() != AbstractJobResult.ReturnCode.SUCCESS) {
              throw new IllegalStateException(jcr.getDescription());
            }

            // Save when the cancel request has been issued
            cancelTime = now;
          }
        } else {

          // Job has already been canceled
          if (cancelTime + maxTimeTillCanceled < now) {
            throw new IllegalStateException("Cancelling of job took " + (now - cancelTime)
              + " milliseconds, only " + maxTimeTillCanceled + " milliseconds are allowed");
          }
        }

        final JobProgressResult jobProgressResult = client.getJobProgress();

        if (jobProgressResult == null) {
          throw new IllegalStateException("Returned job progress is unexpectedly null!");
        }

View Full Code Here

        OptimizedPlan op = compileProgram(jobName);
       
        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

        OptimizedPlan op = pc.compile(plan);
       
        NepheleJobGraphGenerator jgg = new NepheleJobGraphGenerator();
        JobGraph jobGraph = jgg.compileJobGraph(op);
       
        JobClient jobClient = this.nephele.getJobClient(jobGraph);
        JobExecutionResult result = jobClient.submitJobAndWait();
        return result;
      }
      finally {
        if (shutDownAtEnd) {
          stop();
View Full Code Here

      }
     
      Assert.assertNotNull("Obtained null JobGraph", jobGraph);
     
      try {
        JobClient client = this.executor.getJobClient(jobGraph);
        client.setConsoleStreamForReporting(getNullPrintStream());
        this.jobExecutionResult = client.submitJobAndWait();
      }
      catch(Exception e) {
        System.err.println(e.getMessage());
        e.printStackTrace();
        Assert.fail("Job execution failed!");
View Full Code Here

 
  public JobClient getJobClient(JobGraph jobGraph) throws Exception {
    Configuration configuration = jobGraph.getJobConfiguration();
    configuration.setString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY, "localhost");
    configuration.setInteger(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, jobManagerRpcPort);
    return new JobClient(jobGraph, configuration, getClass().getClassLoader());
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.client.JobClient

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.