use of com.qlangtech.plugins.incr.flink.common.FlinkCluster in project plugins by qlangtech.
the class FlinkTaskNodeController method getRCDeployment.
@Override
public IDeploymentDetail getRCDeployment(TargetResName collection) {
ExtendFlinkJobDeploymentDetails rcDeployment = null;
JobID launchJobID = getLaunchJobID(collection);
if (launchJobID == null) {
return null;
}
try {
try (RestClusterClient restClient = this.factory.getFlinkCluster()) {
CompletableFuture<JobStatus> jobStatus = restClient.getJobStatus(launchJobID);
JobStatus status = jobStatus.get(5, TimeUnit.SECONDS);
// }
if (status == null) {
return null;
}
CompletableFuture<JobDetailsInfo> jobDetails = restClient.getJobDetails(launchJobID);
JobDetailsInfo jobDetailsInfo = jobDetails.get(5, TimeUnit.SECONDS);
rcDeployment = new ExtendFlinkJobDeploymentDetails(factory.getClusterCfg(), jobDetailsInfo);
return rcDeployment;
}
} catch (TimeoutException e) {
FlinkCluster clusterCfg = this.factory.getClusterCfg();
throw new TisException("flinkClusterId:" + clusterCfg.getClusterId() + ",Address:" + clusterCfg.getJobManagerAddress().getURL() + "连接超时,请检查相应配置是否正确", e);
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (StringUtils.indexOf(cause.getMessage(), "NotFoundException") > -1) {
return null;
}
// }
throw new RuntimeException(e);
// if (cause instanceof ) {
//
// }
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.qlangtech.plugins.incr.flink.common.FlinkCluster in project plugins by qlangtech.
the class FlinkTaskNodeController method checkUseable.
@Override
public void checkUseable() {
FlinkCluster cluster = factory.getClusterCfg();
try {
try (RestClusterClient restClient = cluster.createFlinkRestClusterClient(Optional.of(1000l))) {
// restClient.getClusterId();
CompletableFuture<Collection<JobStatusMessage>> status = restClient.listJobs();
Collection<JobStatusMessage> jobStatus = status.get();
}
} catch (Exception e) {
throw new TisException("Please check link is valid:" + cluster.getJobManagerAddress().getURL(), e);
}
}
Aggregations