org.apache.flink.runtime.jobmaster.factories.JobManagerJobMetricGroupFactory Java Examples

The following examples show how to use org.apache.flink.runtime.jobmaster.factories.JobManagerJobMetricGroupFactory. 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
Source File: TestingJobManagerRunnerFactory.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	final Supplier<Exception> exceptionSupplier = failJobMasterCreationWith.get();

	if (exceptionSupplier != null) {
		throw exceptionSupplier.get();
	} else {
		jobGraphFuture.complete(jobGraph);

		final JobManagerRunner mock = mock(JobManagerRunner.class);
		when(mock.getResultFuture()).thenReturn(resultFuture);
		when(mock.closeAsync()).thenReturn(terminationFuture);
		when(mock.getJobGraph()).thenReturn(jobGraph);

		return mock;
	}
}
 
Example #2
Source File: DispatcherTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	assertEquals(expectedJobId, jobGraph.getJobID());

	createdJobManagerRunnerLatch.countDown();

	return DefaultJobManagerRunnerFactory.INSTANCE.createJobManagerRunner(
		jobGraph,
		configuration,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		jobManagerSharedServices,
		jobManagerJobMetricGroupFactory,
		fatalErrorHandler);
}
 
Example #3
Source File: TestingJobManagerRunnerFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	final Supplier<Exception> exceptionSupplier = failJobMasterCreationWith.get();

	if (exceptionSupplier != null) {
		throw exceptionSupplier.get();
	} else {
		jobGraphFuture.complete(jobGraph);

		final JobManagerRunner mock = mock(JobManagerRunner.class);
		when(mock.getResultFuture()).thenReturn(resultFuture);
		when(mock.closeAsync()).thenReturn(terminationFuture);
		when(mock.getJobGraph()).thenReturn(jobGraph);

		return mock;
	}
}
 
Example #4
Source File: DispatcherTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	assertEquals(expectedJobId, jobGraph.getJobID());

	createdJobManagerRunnerLatch.countDown();

	return DefaultJobManagerRunnerFactory.INSTANCE.createJobManagerRunner(
		jobGraph,
		configuration,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		jobManagerSharedServices,
		jobManagerJobMetricGroupFactory,
		fatalErrorHandler);
}
 
Example #5
Source File: DispatcherTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	assertEquals(expectedJobId, jobGraph.getJobID());

	createdJobManagerRunnerLatch.countDown();

	return DefaultJobManagerRunnerFactory.INSTANCE.createJobManagerRunner(
		jobGraph,
		configuration,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		jobManagerSharedServices,
		jobManagerJobMetricGroupFactory,
		fatalErrorHandler);
}
 
Example #6
Source File: JobManagerRunnerFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
JobManagerRunner createJobManagerRunner(
JobGraph jobGraph,
Configuration configuration,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
JobManagerSharedServices jobManagerServices,
JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
FatalErrorHandler fatalErrorHandler) throws Exception;
 
Example #7
Source File: JobManagerRunnerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
JobManagerRunner createJobManagerRunner(
JobGraph jobGraph,
Configuration configuration,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
JobManagerSharedServices jobManagerServices,
JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
FatalErrorHandler fatalErrorHandler) throws Exception;
 
Example #8
Source File: JobManagerRunnerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
JobManagerRunner createJobManagerRunner(
JobGraph jobGraph,
Configuration configuration,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
JobManagerSharedServices jobManagerServices,
JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
FatalErrorHandler fatalErrorHandler) throws Exception;
 
Example #9
Source File: TestingJobManagerRunnerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TestingJobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	final TestingJobManagerRunner testingJobManagerRunner = createTestingJobManagerRunner(jobGraph);
	createdJobManagerRunner.offer(testingJobManagerRunner);

	return testingJobManagerRunner;
}
 
Example #10
Source File: JobMaster.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public JobMaster(
		RpcService rpcService,
		JobMasterConfiguration jobMasterConfiguration,
		ResourceID resourceId,
		JobGraph jobGraph,
		HighAvailabilityServices highAvailabilityService,
		SlotPoolFactory slotPoolFactory,
		SchedulerFactory schedulerFactory,
		JobManagerSharedServices jobManagerSharedServices,
		HeartbeatServices heartbeatServices,
		JobManagerJobMetricGroupFactory jobMetricGroupFactory,
		OnCompletionActions jobCompletionActions,
		FatalErrorHandler fatalErrorHandler,
		ClassLoader userCodeLoader) throws Exception {

	super(rpcService, AkkaRpcServiceUtils.createRandomName(JOB_MANAGER_NAME));

	this.jobMasterConfiguration = checkNotNull(jobMasterConfiguration);
	this.resourceId = checkNotNull(resourceId);
	this.jobGraph = checkNotNull(jobGraph);
	this.rpcTimeout = jobMasterConfiguration.getRpcTimeout();
	this.highAvailabilityServices = checkNotNull(highAvailabilityService);
	this.blobWriter = jobManagerSharedServices.getBlobWriter();
	this.scheduledExecutorService = jobManagerSharedServices.getScheduledExecutorService();
	this.jobCompletionActions = checkNotNull(jobCompletionActions);
	this.fatalErrorHandler = checkNotNull(fatalErrorHandler);
	this.userCodeLoader = checkNotNull(userCodeLoader);
	this.heartbeatServices = checkNotNull(heartbeatServices);
	this.jobMetricGroupFactory = checkNotNull(jobMetricGroupFactory);

	final String jobName = jobGraph.getName();
	final JobID jid = jobGraph.getJobID();

	log.info("Initializing job {} ({}).", jobName, jid);

	final RestartStrategies.RestartStrategyConfiguration restartStrategyConfiguration =
			jobGraph.getSerializedExecutionConfig()
					.deserializeValue(userCodeLoader)
					.getRestartStrategy();

	this.restartStrategy = RestartStrategyResolving.resolve(restartStrategyConfiguration,
		jobManagerSharedServices.getRestartStrategyFactory(),
		jobGraph.isCheckpointingEnabled());

	log.info("Using restart strategy {} for {} ({}).", this.restartStrategy, jobName, jid);

	resourceManagerLeaderRetriever = highAvailabilityServices.getResourceManagerLeaderRetriever();

	this.slotPool = checkNotNull(slotPoolFactory).createSlotPool(jobGraph.getJobID());

	this.scheduler = checkNotNull(schedulerFactory).createScheduler(slotPool);

	this.registeredTaskManagers = new HashMap<>(4);

	this.backPressureStatsTracker = checkNotNull(jobManagerSharedServices.getBackPressureStatsTracker());
	this.lastInternalSavepoint = null;

	this.jobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph);
	this.executionGraph = createAndRestoreExecutionGraph(jobManagerJobMetricGroup);
	this.jobStatusListener = null;

	this.resourceManagerConnection = null;
	this.establishedResourceManagerConnection = null;

	this.accumulators = new HashMap<>();
}
 
Example #11
Source File: DispatcherTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerSharedServices jobManagerSharedServices, JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory, FatalErrorHandler fatalErrorHandler) throws Exception {
	jobManagerRunnerCreationLatch.run();

	return super.createJobManagerRunner(jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, jobManagerJobMetricGroupFactory, fatalErrorHandler);
}
 
Example #12
Source File: JobMaster.java    From flink with Apache License 2.0 4 votes vote down vote up
public JobMaster(
		RpcService rpcService,
		JobMasterConfiguration jobMasterConfiguration,
		ResourceID resourceId,
		JobGraph jobGraph,
		HighAvailabilityServices highAvailabilityService,
		SlotPoolFactory slotPoolFactory,
		SchedulerFactory schedulerFactory,
		JobManagerSharedServices jobManagerSharedServices,
		HeartbeatServices heartbeatServices,
		JobManagerJobMetricGroupFactory jobMetricGroupFactory,
		OnCompletionActions jobCompletionActions,
		FatalErrorHandler fatalErrorHandler,
		ClassLoader userCodeLoader,
		SchedulerNGFactory schedulerNGFactory,
		ShuffleMaster<?> shuffleMaster,
		PartitionTrackerFactory partitionTrackerFactory) throws Exception {

	super(rpcService, AkkaRpcServiceUtils.createRandomName(JOB_MANAGER_NAME));

	this.jobMasterConfiguration = checkNotNull(jobMasterConfiguration);
	this.resourceId = checkNotNull(resourceId);
	this.jobGraph = checkNotNull(jobGraph);
	this.rpcTimeout = jobMasterConfiguration.getRpcTimeout();
	this.highAvailabilityServices = checkNotNull(highAvailabilityService);
	this.blobWriter = jobManagerSharedServices.getBlobWriter();
	this.scheduledExecutorService = jobManagerSharedServices.getScheduledExecutorService();
	this.jobCompletionActions = checkNotNull(jobCompletionActions);
	this.fatalErrorHandler = checkNotNull(fatalErrorHandler);
	this.userCodeLoader = checkNotNull(userCodeLoader);
	this.schedulerNGFactory = checkNotNull(schedulerNGFactory);
	this.heartbeatServices = checkNotNull(heartbeatServices);
	this.jobMetricGroupFactory = checkNotNull(jobMetricGroupFactory);

	final String jobName = jobGraph.getName();
	final JobID jid = jobGraph.getJobID();

	log.info("Initializing job {} ({}).", jobName, jid);

	resourceManagerLeaderRetriever = highAvailabilityServices.getResourceManagerLeaderRetriever();

	this.slotPool = checkNotNull(slotPoolFactory).createSlotPool(jobGraph.getJobID());

	this.scheduler = checkNotNull(schedulerFactory).createScheduler(slotPool);

	this.registeredTaskManagers = new HashMap<>(4);
	this.partitionTracker = checkNotNull(partitionTrackerFactory)
		.create(resourceID -> {
			Tuple2<TaskManagerLocation, TaskExecutorGateway> taskManagerInfo = registeredTaskManagers.get(resourceID);
			if (taskManagerInfo == null) {
				return Optional.empty();
			}

			return Optional.of(taskManagerInfo.f1);
		});

	this.backPressureStatsTracker = checkNotNull(jobManagerSharedServices.getBackPressureStatsTracker());

	this.shuffleMaster = checkNotNull(shuffleMaster);

	this.jobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph);
	this.schedulerNG = createScheduler(jobManagerJobMetricGroup);
	this.jobStatusListener = null;

	this.resourceManagerConnection = null;
	this.establishedResourceManagerConnection = null;

	this.accumulators = new HashMap<>();
}
 
Example #13
Source File: DispatcherTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerSharedServices jobManagerSharedServices, JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory, FatalErrorHandler fatalErrorHandler) throws Exception {
	jobManagerRunnerCreationLatch.run();

	return super.createJobManagerRunner(jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, jobManagerJobMetricGroupFactory, fatalErrorHandler);
}
 
Example #14
Source File: JobMaster.java    From flink with Apache License 2.0 4 votes vote down vote up
public JobMaster(
		RpcService rpcService,
		JobMasterConfiguration jobMasterConfiguration,
		ResourceID resourceId,
		JobGraph jobGraph,
		HighAvailabilityServices highAvailabilityService,
		SlotPoolFactory slotPoolFactory,
		SchedulerFactory schedulerFactory,
		JobManagerSharedServices jobManagerSharedServices,
		HeartbeatServices heartbeatServices,
		JobManagerJobMetricGroupFactory jobMetricGroupFactory,
		OnCompletionActions jobCompletionActions,
		FatalErrorHandler fatalErrorHandler,
		ClassLoader userCodeLoader,
		SchedulerNGFactory schedulerNGFactory,
		ShuffleMaster<?> shuffleMaster,
		PartitionTrackerFactory partitionTrackerFactory) throws Exception {

	super(rpcService, AkkaRpcServiceUtils.createRandomName(JOB_MANAGER_NAME), null);

	this.jobMasterConfiguration = checkNotNull(jobMasterConfiguration);
	this.resourceId = checkNotNull(resourceId);
	this.jobGraph = checkNotNull(jobGraph);
	this.rpcTimeout = jobMasterConfiguration.getRpcTimeout();
	this.highAvailabilityServices = checkNotNull(highAvailabilityService);
	this.blobWriter = jobManagerSharedServices.getBlobWriter();
	this.scheduledExecutorService = jobManagerSharedServices.getScheduledExecutorService();
	this.jobCompletionActions = checkNotNull(jobCompletionActions);
	this.fatalErrorHandler = checkNotNull(fatalErrorHandler);
	this.userCodeLoader = checkNotNull(userCodeLoader);
	this.schedulerNGFactory = checkNotNull(schedulerNGFactory);
	this.heartbeatServices = checkNotNull(heartbeatServices);
	this.jobMetricGroupFactory = checkNotNull(jobMetricGroupFactory);

	final String jobName = jobGraph.getName();
	final JobID jid = jobGraph.getJobID();

	log.info("Initializing job {} ({}).", jobName, jid);

	resourceManagerLeaderRetriever = highAvailabilityServices.getResourceManagerLeaderRetriever();

	this.slotPool = checkNotNull(slotPoolFactory).createSlotPool(jobGraph.getJobID());

	this.scheduler = checkNotNull(schedulerFactory).createScheduler(slotPool);

	this.registeredTaskManagers = new HashMap<>(4);
	this.partitionTracker = checkNotNull(partitionTrackerFactory)
		.create(resourceID -> {
			Tuple2<TaskManagerLocation, TaskExecutorGateway> taskManagerInfo = registeredTaskManagers.get(resourceID);
			if (taskManagerInfo == null) {
				return Optional.empty();
			}

			return Optional.of(taskManagerInfo.f1);
		});

	this.backPressureStatsTracker = checkNotNull(jobManagerSharedServices.getBackPressureStatsTracker());

	this.shuffleMaster = checkNotNull(shuffleMaster);

	this.jobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph);
	this.schedulerNG = createScheduler(jobManagerJobMetricGroup);
	this.jobStatusListener = null;

	this.resourceManagerConnection = null;
	this.establishedResourceManagerConnection = null;

	this.accumulators = new HashMap<>();
	this.taskManagerHeartbeatManager = NoOpHeartbeatManager.getInstance();
	this.resourceManagerHeartbeatManager = NoOpHeartbeatManager.getInstance();
}
 
Example #15
Source File: DispatcherResourceCleanupTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerSharedServices jobManagerServices, JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory, FatalErrorHandler fatalErrorHandler) throws Exception {
	throw testException;
}
 
Example #16
Source File: DispatcherTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TestingJobManagerRunner createJobManagerRunner(JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerSharedServices jobManagerSharedServices, JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory, FatalErrorHandler fatalErrorHandler) throws Exception {
	jobManagerRunnerCreationLatch.run();

	return super.createJobManagerRunner(jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, jobManagerJobMetricGroupFactory, fatalErrorHandler);
}