client = clusterDescriptor.deployJobCluster( clusterSpecification, jobGraph, final Thread shutdownHook; if (clusterId != null) { client = clusterDescriptor.retrieve(clusterId); shutdownHook = null; } else { client = clusterDescriptor.deploySessionCluster(clusterSpecification); clusterDescriptor.close(); } catch (Exception e) { LOG.info("Could not properly close the cluster descriptor.", e);
try { clusterClient = clusterDescriptor.retrieve(clusterId); String webInterfaceUrl;
private <T> void deployJobOnNewCluster( ClusterDescriptor<T> clusterDescriptor, JobGraph jobGraph, Result<T> result, ClassLoader classLoader) throws Exception { ClusterClient<T> clusterClient = null; try { // deploy job cluster with job attached clusterClient = clusterDescriptor.deployJobCluster(context.getClusterSpec(), jobGraph, false); // save information about the new cluster result.setClusterInformation(clusterClient.getClusterId(), clusterClient.getWebInterfaceURL()); // get result if (awaitJobResult) { // we need to hard cast for now final JobExecutionResult jobResult = ((RestClusterClient<T>) clusterClient) .requestJobResult(jobGraph.getJobID()) .get() .toJobExecutionResult(context.getClassLoader()); // throws exception if job fails executionResultBucket.add(jobResult); } } finally { try { if (clusterClient != null) { clusterClient.shutdown(); } } catch (Exception e) { // ignore } } }
try { clusterClient = clusterDescriptor.retrieve(context.getClusterId()); try { clusterClient.cancel(new JobID(StringUtils.hexStringToByte(resultId)));
client = clusterDescriptor.deployJobCluster( clusterSpecification, jobGraph, client = clusterDescriptor.retrieve(clusterId); } else { client = clusterDescriptor.deploySessionCluster(clusterSpecification); clusterDescriptor.close(); } catch (Exception e) { LOG.info("Could not properly close the cluster descriptor.", e);
/** * Tests that command line options override the configuration settings. */ @Test public void testManualConfigurationOverride() throws Exception { final String localhost = "localhost"; final int port = 1234; final Configuration configuration = getConfiguration(); configuration.setString(JobManagerOptions.ADDRESS, localhost); configuration.setInteger(JobManagerOptions.PORT, port); @SuppressWarnings("unchecked") final AbstractCustomCommandLine<StandaloneClusterId> defaultCLI = (AbstractCustomCommandLine<StandaloneClusterId>) getCli(configuration); final String manualHostname = "123.123.123.123"; final int manualPort = 4321; final String[] args = {"-m", manualHostname + ':' + manualPort}; CommandLine commandLine = defaultCLI.parseCommandLineOptions(args, false); final ClusterDescriptor<StandaloneClusterId> clusterDescriptor = defaultCLI.createClusterDescriptor(commandLine); final ClusterClient<?> clusterClient = clusterDescriptor.retrieve(defaultCLI.getClusterId(commandLine)); final LeaderConnectionInfo clusterConnectionInfo = clusterClient.getClusterConnectionInfo(); assertThat(clusterConnectionInfo.getHostname(), Matchers.equalTo(manualHostname)); assertThat(clusterConnectionInfo.getPort(), Matchers.equalTo(manualPort)); }
client = clusterDescriptor.deployJobCluster( clusterSpecification, jobGraph, final Thread shutdownHook; if (clusterId != null) { client = clusterDescriptor.retrieve(clusterId); shutdownHook = null; } else { client = clusterDescriptor.deploySessionCluster(clusterSpecification); clusterDescriptor.close(); } catch (Exception e) { LOG.info("Could not properly close the cluster descriptor.", e);
/** * Tests that the configuration is properly passed via the DefaultCLI to the * created ClusterDescriptor. */ @Test public void testConfigurationPassing() throws Exception { final Configuration configuration = getConfiguration(); final String localhost = "localhost"; final int port = 1234; configuration.setString(JobManagerOptions.ADDRESS, localhost); configuration.setInteger(JobManagerOptions.PORT, port); @SuppressWarnings("unchecked") final AbstractCustomCommandLine<StandaloneClusterId> defaultCLI = (AbstractCustomCommandLine<StandaloneClusterId>) getCli(configuration); final String[] args = {}; CommandLine commandLine = defaultCLI.parseCommandLineOptions(args, false); final ClusterDescriptor<StandaloneClusterId> clusterDescriptor = defaultCLI.createClusterDescriptor(commandLine); final ClusterClient<?> clusterClient = clusterDescriptor.retrieve(defaultCLI.getClusterId(commandLine)); final LeaderConnectionInfo clusterConnectionInfo = clusterClient.getClusterConnectionInfo(); assertThat(clusterConnectionInfo.getHostname(), Matchers.equalTo(localhost)); assertThat(clusterConnectionInfo.getPort(), Matchers.equalTo(port)); }