Search in sources :

Example 1 with JobRetrievalException

use of org.apache.flink.runtime.client.JobRetrievalException in project flink by apache.

the class JobRetrievalITCase method testNonExistingJobRetrieval.

@Test
public void testNonExistingJobRetrieval() throws Exception {
    final JobID jobID = new JobID();
    ClusterClient client = new StandaloneClusterClient(cluster.configuration());
    try {
        client.retrieveJob(jobID);
        fail();
    } catch (JobRetrievalException e) {
    // this is what we want
    }
}
Also used : StandaloneClusterClient(org.apache.flink.client.program.StandaloneClusterClient) ClusterClient(org.apache.flink.client.program.ClusterClient) JobRetrievalException(org.apache.flink.runtime.client.JobRetrievalException) StandaloneClusterClient(org.apache.flink.client.program.StandaloneClusterClient) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 2 with JobRetrievalException

use of org.apache.flink.runtime.client.JobRetrievalException in project flink by apache.

the class ClusterClient method retrieveJob.

/**
	 * Reattaches to a running from from the supplied job id
	 * @param jobID The job id of the job to attach to
	 * @return The JobExecutionResult for the jobID
	 * @throws JobExecutionException if an error occurs during monitoring the job execution
	 */
public JobExecutionResult retrieveJob(JobID jobID) throws JobExecutionException {
    final LeaderRetrievalService leaderRetrievalService;
    try {
        leaderRetrievalService = LeaderRetrievalUtils.createLeaderRetrievalService(flinkConfig);
    } catch (Exception e) {
        throw new JobRetrievalException(jobID, "Could not create the leader retrieval service", e);
    }
    ActorGateway jobManagerGateway;
    try {
        jobManagerGateway = getJobManagerGateway();
    } catch (Exception e) {
        throw new JobRetrievalException(jobID, "Could not retrieve the JobManager Gateway");
    }
    final JobListeningContext listeningContext = JobClient.attachToRunningJob(jobID, jobManagerGateway, flinkConfig, actorSystemLoader.get(), leaderRetrievalService, timeout, printStatusDuringExecution);
    return JobClient.awaitJobResult(listeningContext);
}
Also used : JobListeningContext(org.apache.flink.runtime.client.JobListeningContext) JobRetrievalException(org.apache.flink.runtime.client.JobRetrievalException) LeaderRetrievalService(org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService) ActorGateway(org.apache.flink.runtime.instance.ActorGateway) JobRetrievalException(org.apache.flink.runtime.client.JobRetrievalException) URISyntaxException(java.net.URISyntaxException) JobExecutionException(org.apache.flink.runtime.client.JobExecutionException) IOException(java.io.IOException) CompilerException(org.apache.flink.optimizer.CompilerException)

Aggregations

JobRetrievalException (org.apache.flink.runtime.client.JobRetrievalException)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 JobID (org.apache.flink.api.common.JobID)1 ClusterClient (org.apache.flink.client.program.ClusterClient)1 StandaloneClusterClient (org.apache.flink.client.program.StandaloneClusterClient)1 CompilerException (org.apache.flink.optimizer.CompilerException)1 JobExecutionException (org.apache.flink.runtime.client.JobExecutionException)1 JobListeningContext (org.apache.flink.runtime.client.JobListeningContext)1 ActorGateway (org.apache.flink.runtime.instance.ActorGateway)1 LeaderRetrievalService (org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService)1 Test (org.junit.Test)1