Java Code Examples for org.apache.flink.runtime.jobgraph.SavepointRestoreSettings

The following examples show how to use org.apache.flink.runtime.jobgraph.SavepointRestoreSettings. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void restoreJob(ClassLoader classLoader, ClusterClient<?> clusterClient, Deadline deadline, String savepointPath) throws Exception {
	JobGraph jobToRestore = createJobGraph(ExecutionMode.RESTORE);
	jobToRestore.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPath, allowNonRestoredState));

	assertNotNull("Job doesn't have a JobID.", jobToRestore.getJobID());

	clusterClient.submitJob(jobToRestore, classLoader);

	CompletableFuture<JobStatus> jobStatusFuture = FutureUtils.retrySuccessfulWithDelay(
		() -> clusterClient.getJobStatus(jobToRestore.getJobID()),
		Time.milliseconds(50),
		deadline,
		(jobStatus) -> jobStatus == JobStatus.FINISHED,
		TestingUtils.defaultScheduledExecutor());
	assertEquals(
		JobStatus.FINISHED,
		jobStatusFuture.get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS));
}
 
Example 2
@Override
public StandaloneApplicationClusterConfiguration createResult(@Nonnull CommandLine commandLine) throws FlinkParseException {
	final String configDir = commandLine.getOptionValue(CONFIG_DIR_OPTION.getOpt());
	final Properties dynamicProperties = commandLine.getOptionProperties(DYNAMIC_PROPERTY_OPTION.getOpt());
	final int restPort = getRestPort(commandLine);
	final String hostname = commandLine.getOptionValue(HOST_OPTION.getOpt());
	final SavepointRestoreSettings savepointRestoreSettings = CliFrontendParser.createSavepointRestoreSettings(commandLine);
	final JobID jobId = getJobId(commandLine);
	final String jobClassName = commandLine.getOptionValue(JOB_CLASS_NAME_OPTION.getOpt());

	return new StandaloneApplicationClusterConfiguration(
		configDir,
		dynamicProperties,
		commandLine.getArgs(),
		hostname,
		restPort,
		savepointRestoreSettings,
		jobId,
		jobClassName);
}
 
Example 3
Source Project: df_data_service   Source File: DFCusterClient.java    License: Apache License 2.0 6 votes vote down vote up
private JobGraph getJobGraph(FlinkPlan optPlan, List<URL> jarFiles, List<URL> classpaths, SavepointRestoreSettings savepointSettings) {
	JobGraph job;
	if (optPlan instanceof StreamingPlan) {
		job = ((StreamingPlan) optPlan).getJobGraph();
		job.setSavepointRestoreSettings(savepointSettings);
	} else {
		JobGraphGenerator gen = new JobGraphGenerator(this.flinkConfig);
		job = gen.compileJobGraph((OptimizedPlan) optPlan);
	}

	for (URL jar : jarFiles) {
		try {
			job.addJar(new Path(jar.toURI()));
		} catch (URISyntaxException e) {
			throw new RuntimeException("URL is invalid. This should not happen.", e);
		}
	}

	job.setClasspaths(classpaths);

	return job;
}
 
Example 4
@Test
public void testJobGraphRetrievalJobClassNameHasPrecedenceOverClassPath() throws FlinkException, FileNotFoundException {
	final File testJar = new File("non-existing");

	final ClassPathJobGraphRetriever classPathJobGraphRetriever = new ClassPathJobGraphRetriever(
		new JobID(),
		SavepointRestoreSettings.none(),
		PROGRAM_ARGUMENTS,
		// Both a class name is specified and a JAR "is" on the class path
		// The class name should have precedence.
		TestJob.class.getCanonicalName(),
		() -> Collections.singleton(testJar));

	final JobGraph jobGraph = classPathJobGraphRetriever.retrieveJobGraph(new Configuration());

	assertThat(jobGraph.getName(), is(equalTo(TestJob.class.getCanonicalName() + "-suffix")));
}
 
Example 5
@Test
public void testSavepointRestoreSettings() throws FlinkException {
	final Configuration configuration = new Configuration();
	final SavepointRestoreSettings savepointRestoreSettings = SavepointRestoreSettings.forPath("foobar", true);
	final JobID jobId = new JobID();

	final ClassPathJobGraphRetriever classPathJobGraphRetriever = new ClassPathJobGraphRetriever(
		jobId,
		savepointRestoreSettings,
		PROGRAM_ARGUMENTS,
		TestJob.class.getCanonicalName());

	final JobGraph jobGraph = classPathJobGraphRetriever.retrieveJobGraph(configuration);

	assertThat(jobGraph.getSavepointRestoreSettings(), is(equalTo(savepointRestoreSettings)));
	assertEquals(jobGraph.getJobID(), jobId);
}
 
Example 6
Source Project: flink   Source File: RemoteStreamEnvironmentTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testRemoteExecutionWithSavepoint() throws Exception {
	SavepointRestoreSettings restoreSettings = SavepointRestoreSettings.forPath("fakePath");
	JobID jobID = new JobID();

	TestExecutorServiceLoader testExecutorServiceLoader = new TestExecutorServiceLoader(jobID);
	RemoteStreamEnvironment env = new RemoteStreamEnvironment(
			testExecutorServiceLoader,
			"fakeHost",
			1,
			null,
			new String[]{},
			null,
			restoreSettings);

	env.fromElements(1).map(x -> x * 2);

	JobExecutionResult actualResult = env.execute("fakeJobName");
	assertThat(actualResult.getJobID(), is(jobID));
	assertThat(
			testExecutorServiceLoader.getActualSavepointRestoreSettings(), is(restoreSettings));
}
 
Example 7
Source Project: Flink-CEPplus   Source File: JarRunHandler.java    License: Apache License 2.0 6 votes vote down vote up
private SavepointRestoreSettings getSavepointRestoreSettings(
		final @Nonnull HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request)
			throws RestHandlerException {

	final JarRunRequestBody requestBody = request.getRequestBody();

	final boolean allowNonRestoredState = fromRequestBodyOrQueryParameter(
		requestBody.getAllowNonRestoredState(),
		() -> getQueryParameter(request, AllowNonRestoredStateQueryParameter.class),
		false,
		log);
	final String savepointPath = fromRequestBodyOrQueryParameter(
		emptyToNull(requestBody.getSavepointPath()),
		() -> emptyToNull(getQueryParameter(request, SavepointPathQueryParameter.class)),
		null,
		log);
	final SavepointRestoreSettings savepointRestoreSettings;
	if (savepointPath != null) {
		savepointRestoreSettings = SavepointRestoreSettings.forPath(
			savepointPath,
			allowNonRestoredState);
	} else {
		savepointRestoreSettings = SavepointRestoreSettings.none();
	}
	return savepointRestoreSettings;
}
 
Example 8
@Test
public void testEntrypointClusterConfigurationParsing() throws FlinkParseException {
	final String key = "key";
	final String value = "value";
	final int restPort = 1234;
	final String arg1 = "arg1";
	final String arg2 = "arg2";
	final String[] args = {"--configDir", confDirPath, "--webui-port", String.valueOf(restPort), "--job-classname", JOB_CLASS_NAME, String.format("-D%s=%s", key, value), arg1, arg2};

	final StandaloneApplicationClusterConfiguration clusterConfiguration = commandLineParser.parse(args);

	assertThat(clusterConfiguration.getConfigDir(), is(equalTo(confDirPath)));
	assertThat(clusterConfiguration.getJobClassName(), is(equalTo(JOB_CLASS_NAME)));
	assertThat(clusterConfiguration.getRestPort(), is(equalTo(restPort)));
	final Properties dynamicProperties = clusterConfiguration.getDynamicProperties();

	assertThat(dynamicProperties, hasEntry(key, value));

	assertThat(clusterConfiguration.getArgs(), arrayContaining(arg1, arg2));

	assertThat(clusterConfiguration.getSavepointRestoreSettings(), is(equalTo(SavepointRestoreSettings.none())));

	assertThat(clusterConfiguration.getJobId(), is(nullValue()));
}
 
Example 9
Source Project: Flink-CEPplus   Source File: JobMasterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
private JobGraph createJobGraphFromJobVerticesWithCheckpointing(SavepointRestoreSettings savepointRestoreSettings, JobVertex... jobVertices) {
	final JobGraph jobGraph = new JobGraph(jobVertices);

	// enable checkpointing which is required to resume from a savepoint
	final CheckpointCoordinatorConfiguration checkpoinCoordinatorConfiguration = new CheckpointCoordinatorConfiguration(
		1000L,
		1000L,
		1000L,
		1,
		CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION,
		true);
	final JobCheckpointingSettings checkpointingSettings = new JobCheckpointingSettings(
		Collections.emptyList(),
		Collections.emptyList(),
		Collections.emptyList(),
		checkpoinCoordinatorConfiguration,
		null);
	jobGraph.setSnapshotSettings(checkpointingSettings);
	jobGraph.setSavepointRestoreSettings(savepointRestoreSettings);

	return jobGraph;
}
 
Example 10
Source Project: Flink-CEPplus   Source File: ClusterClient.java    License: Apache License 2.0 6 votes vote down vote up
public static JobGraph getJobGraph(Configuration flinkConfig, FlinkPlan optPlan, List<URL> jarFiles, List<URL> classpaths, SavepointRestoreSettings savepointSettings) {
	JobGraph job;
	if (optPlan instanceof StreamingPlan) {
		job = ((StreamingPlan) optPlan).getJobGraph();
		job.setSavepointRestoreSettings(savepointSettings);
	} else {
		JobGraphGenerator gen = new JobGraphGenerator(flinkConfig);
		job = gen.compileJobGraph((OptimizedPlan) optPlan);
	}

	for (URL jar : jarFiles) {
		try {
			job.addJar(new Path(jar.toURI()));
		} catch (URISyntaxException e) {
			throw new RuntimeException("URL is invalid. This should not happen.", e);
		}
	}

	job.setClasspaths(classpaths);

	return job;
}
 
Example 11
Source Project: flink   Source File: JobMasterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
private JobGraph createJobGraphFromJobVerticesWithCheckpointing(SavepointRestoreSettings savepointRestoreSettings, JobVertex... jobVertices) {
	final JobGraph jobGraph = new JobGraph(jobVertices);

	// enable checkpointing which is required to resume from a savepoint
	final CheckpointCoordinatorConfiguration checkpoinCoordinatorConfiguration = new CheckpointCoordinatorConfiguration(
		1000L,
		1000L,
		1000L,
		1,
		CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION,
		true,
		false,
		false,
		0);
	final JobCheckpointingSettings checkpointingSettings = new JobCheckpointingSettings(
		Collections.emptyList(),
		Collections.emptyList(),
		Collections.emptyList(),
		checkpoinCoordinatorConfiguration,
		null);
	jobGraph.setSnapshotSettings(checkpointingSettings);
	jobGraph.setSavepointRestoreSettings(savepointRestoreSettings);

	return jobGraph;
}
 
Example 12
@Test
public void testSavepointRestoreSettings() throws FlinkException, IOException, ProgramInvocationException {
	final Configuration configuration = new Configuration();
	final SavepointRestoreSettings savepointRestoreSettings = SavepointRestoreSettings.forPath("foobar", true);
	final JobID jobId = new JobID();

	configuration.setString(PipelineOptionsInternal.PIPELINE_FIXED_JOB_ID, jobId.toHexString());
	SavepointRestoreSettings.toConfiguration(savepointRestoreSettings, configuration);

	final ClassPathPackagedProgramRetriever retrieverUnderTest =
		ClassPathPackagedProgramRetriever.newBuilder(PROGRAM_ARGUMENTS)
		.setJobClassName(TestJob.class.getCanonicalName())
		.build();

	final JobGraph jobGraph = retrieveJobGraph(retrieverUnderTest, configuration);

	assertThat(jobGraph.getSavepointRestoreSettings(), is(equalTo(savepointRestoreSettings)));
	assertEquals(jobGraph.getJobID(), jobId);
}
 
Example 13
Source Project: Flink-CEPplus   Source File: RemoteStreamEnvironment.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Executes the job remotely.
 *
 * <p>This method can be used independent of the {@link StreamExecutionEnvironment} type.
 * @return The result of the job execution, containing elapsed time and accumulators.
 */
@PublicEvolving
public static JobExecutionResult executeRemotely(StreamExecutionEnvironment streamExecutionEnvironment,
	List<URL> jarFiles,
	String host,
	int port,
	Configuration clientConfiguration,
	List<URL> globalClasspaths,
	String jobName,
	SavepointRestoreSettings savepointRestoreSettings
) throws ProgramInvocationException {
	StreamGraph streamGraph = streamExecutionEnvironment.getStreamGraph();
	streamGraph.setJobName(jobName);
	return executeRemotely(streamGraph,
		streamExecutionEnvironment.getClass().getClassLoader(),
		streamExecutionEnvironment.getConfig(),
		jarFiles,
		host,
		port,
		clientConfiguration,
		globalClasspaths,
		savepointRestoreSettings);
}
 
Example 14
Source Project: flink   Source File: JarRunHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<JarRunResponseBody> handleRequest(
		@Nonnull final HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request,
		@Nonnull final DispatcherGateway gateway) throws RestHandlerException {

	final Configuration effectiveConfiguration = new Configuration(configuration);
	effectiveConfiguration.set(DeploymentOptions.ATTACHED, false);
	effectiveConfiguration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME);

	final JarHandlerContext context = JarHandlerContext.fromRequest(request, jarDir, log);
	context.applyToConfiguration(effectiveConfiguration);
	SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(request), effectiveConfiguration);

	final PackagedProgram program = context.toPackagedProgram(effectiveConfiguration);

	return CompletableFuture
			.supplyAsync(() -> applicationRunner.run(gateway, program, effectiveConfiguration), executor)
			.thenApply(jobIds -> {
				if (jobIds.isEmpty()) {
					throw new CompletionException(new ProgramInvocationException("No jobs submitted."));
				}
				return new JarRunResponseBody(jobIds.get(0));
			});
}
 
Example 15
Source Project: flink   Source File: RemoteStreamEnvironment.java    License: Apache License 2.0 6 votes vote down vote up
private static Configuration validateAndGetEffectiveConfiguration(
		final Configuration configuration,
		final String host,
		final int port,
		final String[] jarFiles,
		final URL[] classpaths,
		final SavepointRestoreSettings savepointRestoreSettings) {
	RemoteEnvironmentConfigUtils.validate(host, port);
	return getEffectiveConfiguration(
			getClientConfiguration(configuration),
			host,
			port,
			jarFiles,
			getClasspathURLs(classpaths),
			savepointRestoreSettings);
}
 
Example 16
Source Project: flink   Source File: ClassPathJobGraphRetrieverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testJobGraphRetrieval() throws FlinkException {
	final int parallelism = 42;
	final Configuration configuration = new Configuration();
	configuration.setInteger(CoreOptions.DEFAULT_PARALLELISM, parallelism);
	final JobID jobId = new JobID();

	final ClassPathJobGraphRetriever classPathJobGraphRetriever = new ClassPathJobGraphRetriever(
		jobId,
		SavepointRestoreSettings.none(),
		PROGRAM_ARGUMENTS,
		TestJob.class.getCanonicalName());

	final JobGraph jobGraph = classPathJobGraphRetriever.retrieveJobGraph(configuration);

	assertThat(jobGraph.getName(), is(equalTo(TestJob.class.getCanonicalName() + "-suffix")));
	assertThat(jobGraph.getMaximumParallelism(), is(parallelism));
	assertEquals(jobGraph.getJobID(), jobId);
}
 
Example 17
@Test
public void testRemoteExecutionWithSavepoint() throws Exception {
	SavepointRestoreSettings restoreSettings = SavepointRestoreSettings.forPath("fakePath");
	RemoteStreamEnvironment env = new RemoteStreamEnvironment("fakeHost", 1,
		null, new String[]{}, null, restoreSettings);
	env.fromElements(1).map(x -> x * 2);

	RestClusterClient mockedClient = Mockito.mock(RestClusterClient.class);
	JobExecutionResult expectedResult = new JobExecutionResult(null, 0, null);

	PowerMockito.whenNew(RestClusterClient.class).withAnyArguments().thenReturn(mockedClient);
	when(mockedClient.run(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(restoreSettings)))
		.thenReturn(expectedResult);

	JobExecutionResult actualResult = env.execute("fakeJobName");
	Assert.assertEquals(expectedResult, actualResult);
}
 
Example 18
Source Project: flink   Source File: ClassPathJobGraphRetrieverTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testJobGraphRetrievalJobClassNameHasPrecedenceOverClassPath() throws FlinkException, FileNotFoundException {
	final File testJar = new File("non-existing");

	final ClassPathJobGraphRetriever classPathJobGraphRetriever = new ClassPathJobGraphRetriever(
		new JobID(),
		SavepointRestoreSettings.none(),
		PROGRAM_ARGUMENTS,
		// Both a class name is specified and a JAR "is" on the class path
		// The class name should have precedence.
		TestJob.class.getCanonicalName(),
		() -> Collections.singleton(testJar));

	final JobGraph jobGraph = classPathJobGraphRetriever.retrieveJobGraph(new Configuration());

	assertThat(jobGraph.getName(), is(equalTo(TestJob.class.getCanonicalName() + "-suffix")));
}
 
Example 19
@Test
public void testEntrypointClusterConfigurationParsing() throws FlinkParseException {
	final String key = "key";
	final String value = "value";
	final int restPort = 1234;
	final String arg1 = "arg1";
	final String arg2 = "arg2";
	final String[] args = {"--configDir", confDirPath, "--webui-port", String.valueOf(restPort), "--job-classname", JOB_CLASS_NAME, String.format("-D%s=%s", key, value), arg1, arg2};

	final StandaloneJobClusterConfiguration clusterConfiguration = commandLineParser.parse(args);

	assertThat(clusterConfiguration.getConfigDir(), is(equalTo(confDirPath)));
	assertThat(clusterConfiguration.getJobClassName(), is(equalTo(JOB_CLASS_NAME)));
	assertThat(clusterConfiguration.getRestPort(), is(equalTo(restPort)));
	final Properties dynamicProperties = clusterConfiguration.getDynamicProperties();

	assertThat(dynamicProperties, hasEntry(key, value));

	assertThat(clusterConfiguration.getArgs(), arrayContaining(arg1, arg2));

	assertThat(clusterConfiguration.getSavepointRestoreSettings(), is(equalTo(SavepointRestoreSettings.none())));

	assertThat(clusterConfiguration.getJobId(), is(nullValue()));
}
 
Example 20
@Test
public void testShortOptions() throws FlinkParseException {
	final String jobClassName = "foobar";
	final JobID jobId = new JobID();
	final String savepointRestorePath = "s3://foo/bar";

	final String[] args = {
		"-c", confDirPath,
		"-j", jobClassName,
		"-jid", jobId.toString(),
		"-s", savepointRestorePath,
		"-n"};

	final StandaloneJobClusterConfiguration clusterConfiguration = commandLineParser.parse(args);

	assertThat(clusterConfiguration.getConfigDir(), is(equalTo(confDirPath)));
	assertThat(clusterConfiguration.getJobClassName(), is(equalTo(jobClassName)));
	assertThat(clusterConfiguration.getJobId(), is(equalTo(jobId)));

	final SavepointRestoreSettings savepointRestoreSettings = clusterConfiguration.getSavepointRestoreSettings();
	assertThat(savepointRestoreSettings.restoreSavepoint(), is(true));
	assertThat(savepointRestoreSettings.getRestorePath(), is(equalTo(savepointRestorePath)));
	assertThat(savepointRestoreSettings.allowNonRestoredState(), is(true));
}
 
Example 21
Source Project: flink   Source File: JarRunHandler.java    License: Apache License 2.0 6 votes vote down vote up
private SavepointRestoreSettings getSavepointRestoreSettings(
		final @Nonnull HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request)
			throws RestHandlerException {

	final JarRunRequestBody requestBody = request.getRequestBody();

	final boolean allowNonRestoredState = fromRequestBodyOrQueryParameter(
		requestBody.getAllowNonRestoredState(),
		() -> getQueryParameter(request, AllowNonRestoredStateQueryParameter.class),
		false,
		log);
	final String savepointPath = fromRequestBodyOrQueryParameter(
		emptyToNull(requestBody.getSavepointPath()),
		() -> emptyToNull(getQueryParameter(request, SavepointPathQueryParameter.class)),
		null,
		log);
	final SavepointRestoreSettings savepointRestoreSettings;
	if (savepointPath != null) {
		savepointRestoreSettings = SavepointRestoreSettings.forPath(
			savepointPath,
			allowNonRestoredState);
	} else {
		savepointRestoreSettings = SavepointRestoreSettings.none();
	}
	return savepointRestoreSettings;
}
 
Example 22
Source Project: sylph   Source File: FlinkContainerFactory.java    License: Apache License 2.0 6 votes vote down vote up
public static void setSavepoint(JobGraph jobGraph, Path appCheckPath, Configuration hadoopConf)
        throws Exception
{
    //How to use `savepoints` to restore a job
    jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.none());
    FileSystem fileSystem = FileSystem.get(hadoopConf);
    if (!fileSystem.exists(appCheckPath)) {
        return;
    }
    List<FileStatus> appCheckDirFiles = Stream.of(fileSystem.listStatus(appCheckPath))
            .filter(file -> file.getPath().getName().startsWith(CHECKPOINT_DIR_PREFIX))
            .sorted((x, y) -> Long.compare(y.getModificationTime(), x.getModificationTime()))
            .collect(Collectors.toList());
    for (FileStatus fileStatus : appCheckDirFiles) {
        Path metadataFile = new Path(fileStatus.getPath().toString(), METADATA_FILE_NAME);
        if (fileSystem.exists(metadataFile)) {
            //allowNonRestoredState (可选):布尔值,指定如果保存点包含无法映射回作业的状态,是否应拒绝作业提交。 default is false
            logger.info("Find Savepoint {}", metadataFile);
            jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(metadataFile.toString(), true));
            break;
        }
    }
}
 
Example 23
Source Project: flink   Source File: SchedulerBase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tries to restore the given {@link ExecutionGraph} from the provided {@link SavepointRestoreSettings}.
 *
 * @param executionGraphToRestore {@link ExecutionGraph} which is supposed to be restored
 * @param savepointRestoreSettings {@link SavepointRestoreSettings} containing information about the savepoint to restore from
 * @throws Exception if the {@link ExecutionGraph} could not be restored
 */
private void tryRestoreExecutionGraphFromSavepoint(ExecutionGraph executionGraphToRestore, SavepointRestoreSettings savepointRestoreSettings) throws Exception {
	if (savepointRestoreSettings.restoreSavepoint()) {
		final CheckpointCoordinator checkpointCoordinator = executionGraphToRestore.getCheckpointCoordinator();
		if (checkpointCoordinator != null) {
			checkpointCoordinator.restoreSavepoint(
				savepointRestoreSettings.getRestorePath(),
				savepointRestoreSettings.allowNonRestoredState(),
				executionGraphToRestore.getAllVertices(),
				userCodeLoader);
		}
	}
}
 
Example 24
Source Project: flink   Source File: ContextEnvironmentFactory.java    License: Apache License 2.0 5 votes vote down vote up
public ContextEnvironmentFactory(ClusterClient<?> client, List<URL> jarFilesToAttach,
		List<URL> classpathsToAttach, ClassLoader userCodeClassLoader, int defaultParallelism,
		boolean isDetached, SavepointRestoreSettings savepointSettings) {
	this.client = client;
	this.jarFilesToAttach = jarFilesToAttach;
	this.classpathsToAttach = classpathsToAttach;
	this.userCodeClassLoader = userCodeClassLoader;
	this.defaultParallelism = defaultParallelism;
	this.isDetached = isDetached;
	this.savepointSettings = savepointSettings;
}
 
Example 25
StandaloneJobClusterConfiguration(
		@Nonnull String configDir,
		@Nonnull Properties dynamicProperties,
		@Nonnull String[] args,
		@Nullable String hostname,
		int restPort,
		@Nonnull SavepointRestoreSettings savepointRestoreSettings,
		@Nullable JobID jobId,
		@Nullable String jobClassName) {
	super(configDir, dynamicProperties, args, hostname, restPort);
	this.savepointRestoreSettings = requireNonNull(savepointRestoreSettings, "savepointRestoreSettings");
	this.jobId = jobId;
	this.jobClassName = jobClassName;
}
 
Example 26
Source Project: flink   Source File: ContextEnvironment.java    License: Apache License 2.0 5 votes vote down vote up
public ContextEnvironment(ClusterClient<?> remoteConnection, List<URL> jarFiles, List<URL> classpaths,
			ClassLoader userCodeClassLoader, SavepointRestoreSettings savepointSettings) {
	this.client = remoteConnection;
	this.jarFilesToAttach = jarFiles;
	this.classpathsToAttach = classpaths;
	this.userCodeClassLoader = userCodeClassLoader;
	this.savepointSettings = savepointSettings;
}
 
Example 27
Source Project: Flink-CEPplus   Source File: ClassPathJobGraphRetriever.java    License: Apache License 2.0 5 votes vote down vote up
ClassPathJobGraphRetriever(
		@Nonnull JobID jobId,
		@Nonnull SavepointRestoreSettings savepointRestoreSettings,
		@Nonnull String[] programArguments,
		@Nullable String jobClassName) {
	this(jobId, savepointRestoreSettings, programArguments, jobClassName, JarsOnClassPath.INSTANCE);
}
 
Example 28
Source Project: Flink-CEPplus   Source File: ClassPathJobGraphRetriever.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
ClassPathJobGraphRetriever(
		@Nonnull JobID jobId,
		@Nonnull SavepointRestoreSettings savepointRestoreSettings,
		@Nonnull String[] programArguments,
		@Nullable String jobClassName,
		@Nonnull Supplier<Iterable<File>> jarsOnClassPath) {
	this.jobId = requireNonNull(jobId, "jobId");
	this.savepointRestoreSettings = requireNonNull(savepointRestoreSettings, "savepointRestoreSettings");
	this.programArguments = requireNonNull(programArguments, "programArguments");
	this.jobClassName = jobClassName;
	this.jarsOnClassPath = requireNonNull(jarsOnClassPath, "jarsOnClassPath");
}
 
Example 29
private StandaloneJobClusterEntryPoint(
		Configuration configuration,
		@Nonnull JobID jobId,
		@Nonnull SavepointRestoreSettings savepointRestoreSettings,
		@Nonnull String[] programArguments,
		@Nullable String jobClassName) {
	super(configuration);
	this.jobId = requireNonNull(jobId, "jobId");
	this.savepointRestoreSettings = requireNonNull(savepointRestoreSettings, "savepointRestoreSettings");
	this.programArguments = requireNonNull(programArguments, "programArguments");
	this.jobClassName = jobClassName;
}
 
Example 30
@Test
public void testJobGraphRetrievalFromJar() throws FlinkException, FileNotFoundException {
	final File testJar = TestJob.getTestJobJar();
	final ClassPathJobGraphRetriever classPathJobGraphRetriever = new ClassPathJobGraphRetriever(
		new JobID(),
		SavepointRestoreSettings.none(),
		PROGRAM_ARGUMENTS,
		// No class name specified, but the test JAR "is" on the class path
		null,
		() -> Collections.singleton(testJar));

	final JobGraph jobGraph = classPathJobGraphRetriever.retrieveJobGraph(new Configuration());

	assertThat(jobGraph.getName(), is(equalTo(TestJob.class.getCanonicalName() + "-suffix")));
}