use of com.hazelcast.jet.impl.execution.TaskletExecutionService in project hazelcast-jet by hazelcast.
the class JobExecutionService method initExecution.
/**
* Initiates the given execution if the local node accepts the coordinator
* as its master, and has an up-to-date member list information.
* <ul><li>
* If the local node has a stale member list, it retries the init operation
* until it receives the new member list from the master.
* </li><li>
* If the local node detects that the member list changed after the init
* operation is sent but before executed, then it sends a graceful failure
* so that the job init will be retried properly.
* </li><li>
* If there is an already ongoing execution for the given job, then the
* init execution is retried.
* </li></ul>
*/
public void initExecution(long jobId, long executionId, Address coordinator, int coordinatorMemberListVersion, Set<MemberInfo> participants, ExecutionPlan plan) {
verifyClusterInformation(jobId, executionId, coordinator, coordinatorMemberListVersion, participants);
failIfNotRunning();
if (!executionContextJobIds.add(jobId)) {
ExecutionContext current = executionContexts.get(executionId);
if (current != null) {
throw new IllegalStateException(String.format("Execution context for %s for coordinator %s already exists for coordinator %s", jobAndExecutionId(jobId, executionId), coordinator, current.coordinator()));
}
executionContexts.values().stream().filter(e -> e.jobId() == jobId).forEach(e -> logger.fine(String.format("Execution context for %s for coordinator %s already exists" + " with local execution %s for coordinator %s", jobAndExecutionId(jobId, executionId), coordinator, idToString(e.jobId()), e.coordinator())));
throw new RetryableHazelcastException();
}
Set<Address> addresses = participants.stream().map(MemberInfo::getAddress).collect(toSet());
ExecutionContext created = new ExecutionContext(nodeEngine, taskletExecutionService, jobId, executionId, coordinator, addresses);
try {
created.initialize(plan);
} finally {
executionContexts.put(executionId, created);
}
logger.info("Execution plan for " + jobAndExecutionId(jobId, executionId) + " initialized");
}
use of com.hazelcast.jet.impl.execution.TaskletExecutionService in project hazelcast by hazelcast.
the class JetServiceBackend method init.
// ManagedService
@Override
public void init(NodeEngine engine, Properties hzProperties) {
this.nodeEngine = (NodeEngineImpl) engine;
this.jet = new JetInstanceImpl(nodeEngine.getNode().hazelcastInstance, jetConfig);
jobRepository = new JobRepository(engine.getHazelcastInstance());
taskletExecutionService = new TaskletExecutionService(nodeEngine, jetConfig.getCooperativeThreadCount(), nodeEngine.getProperties());
jobCoordinationService = createJobCoordinationService();
jobClassLoaderService = new JobClassLoaderService(nodeEngine, jobRepository);
jobExecutionService = new JobExecutionService(nodeEngine, taskletExecutionService, jobClassLoaderService);
MetricsService metricsService = nodeEngine.getService(MetricsService.SERVICE_NAME);
metricsService.registerPublisher(nodeEngine -> new JobMetricsPublisher(jobExecutionService, nodeEngine.getLocalMember()));
nodeEngine.getMetricsRegistry().registerDynamicMetricsProvider(jobExecutionService);
networking = new Networking(engine, jobExecutionService, jetConfig.getFlowControlPeriodMs());
ClientEngine clientEngine = engine.getService(ClientEngineImpl.SERVICE_NAME);
ClientExceptionFactory clientExceptionFactory = clientEngine.getExceptionFactory();
if (clientExceptionFactory != null) {
ExceptionUtil.registerJetExceptions(clientExceptionFactory);
} else {
logger.fine("Jet exceptions are not registered to the ClientExceptionFactory" + " since the ClientExceptionFactory is not accessible.");
}
logger.info("Setting number of cooperative threads and default parallelism to " + jetConfig.getCooperativeThreadCount());
}
use of com.hazelcast.jet.impl.execution.TaskletExecutionService in project hazelcast-jet by hazelcast.
the class JetService method init.
// ManagedService
@Override
public void init(NodeEngine engine, Properties properties) {
if (config == null) {
throw new IllegalStateException("JetConfig is not initialized");
}
jetInstance = new JetInstanceImpl((HazelcastInstanceImpl) engine.getHazelcastInstance(), config);
taskletExecutionService = new TaskletExecutionService(nodeEngine.getHazelcastInstance(), config.getInstanceConfig().getCooperativeThreadCount());
snapshotRepository = new SnapshotRepository(jetInstance);
jobRepository = new JobRepository(jetInstance, snapshotRepository);
jobExecutionService = new JobExecutionService(nodeEngine, taskletExecutionService);
jobCoordinationService = new JobCoordinationService(nodeEngine, config, jobRepository, jobExecutionService, snapshotRepository);
networking = new Networking(engine, jobExecutionService, config.getInstanceConfig().getFlowControlPeriodMs());
ClientEngineImpl clientEngine = engine.getService(ClientEngineImpl.SERVICE_NAME);
ExceptionUtil.registerJetExceptions(clientEngine.getClientExceptionFactory());
jobCoordinationService.init();
JetBuildInfo jetBuildInfo = BuildInfoProvider.getBuildInfo().getJetBuildInfo();
logger.info(String.format("Starting Jet %s (%s - %s)", jetBuildInfo.getVersion(), jetBuildInfo.getBuild(), jetBuildInfo.getRevision()));
logger.info("Setting number of cooperative threads and default parallelism to " + config.getInstanceConfig().getCooperativeThreadCount());
logger.info('\n' + "\to o o o---o o---o o o---o o o---o o-o-o o o---o o-o-o\n" + "\t| | / \\ / | | | / \\ | | | | | \n" + "\to---o o---o o o-o | o o---o o---o | | o-o | \n" + "\t| | | | / | | | | | | | \\ | | | \n" + "\to o o o o---o o---o o---o o---o o o o---o o o--o o---o o ");
logger.info("Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.");
}
Aggregations