@Inject public ClusterService(ClusterStoreService clusterStoreService, EntityStoreService entityStoreService, TenantProvisionerService tenantProvisionerService, QueueService queueService, LockService lockService, ServerStats serverStats, Solver solver, IdService idService, CredentialStore credentialStore, Gson gson, TemplateMerger templateMerger) { this.clusterStoreService = clusterStoreService; this.clusterStore = clusterStoreService.getSystemView(); this.entityStoreService = entityStoreService; this.tenantProvisionerService = tenantProvisionerService; this.credentialStore = credentialStore; this.lockService = lockService; this.serverStats = serverStats; this.solver = solver; this.idService = idService; this.gson = gson; this.clusterQueues = queueService.getQueueGroup(QueueType.CLUSTER); this.solverQueues = queueService.getQueueGroup(QueueType.SOLVER); this.jobQueues = queueService.getQueueGroup(QueueType.JOB); this.templateMerger = templateMerger; }
credentialStore.startAndWait(); queueService = injector.getInstance(QueueService.class); queueService.startAndWait(); if (securityEnabled) { externalAuthenticationServer = injector.getInstance(ExternalAuthenticationServer.class);
/** * Delete the given tenant. A tenant must not have any assigned workers in order for deletion to be allowed. * * @param name Name of the tenant to delete * @throws IllegalStateException if the tenant has one or more assigned workers * @throws IOException if there was an exception persisting the deletion */ public void deleteTenantByName(String name) throws IllegalStateException, IOException { tenantLock.lock(); try { Tenant tenant = tenantStore.getTenantByName(name); if (tenant == null) { return; } int numAssignedWorkers = provisionerStore.getNumAssignedWorkers(tenant.getId()); if (numAssignedWorkers > 0) { throw new IllegalStateException("Tenant " + name + " still has " + numAssignedWorkers + " workers. " + "Cannot delete it until workers are set to 0."); } tenantStore.deleteTenantByName(name); for (QueueGroup queueGroup : queueService.getAllQueueGroups().values()) { queueGroup.removeAll(tenant.getId()); } } finally { tenantLock.unlock(); } }
userStore = sqlUserStore; queueService = injector.getInstance(QueueService.class); queueService.startAndWait();
@Inject private ClusterScheduler(@Named("scheduler.id") String id, ClusterStoreService clusterStoreService, TaskService taskService, IdService idService, QueueService queueService) { this.id = id; this.clusterStore = clusterStoreService.getSystemView(); this.taskService = taskService; this.idService = idService; this.clusterQueues = queueService.getQueueGroup(QueueType.CLUSTER); }
@Inject private SolverScheduler(@Named("scheduler.id") String id, Solver solver, ClusterStoreService clusterStoreService, QueueService queueService, @Named("solver.executor.service") ListeningExecutorService executorService, TaskService taskService, ServerStats serverStats, IdService idService, Gson gson) { this.id = id; this.solver = solver; this.clusterStore = clusterStoreService.getSystemView(); this.executorService = executorService; this.taskService = taskService; this.serverStats = serverStats; this.idService = idService; this.gson = gson; this.solverQueues = queueService.getQueueGroup(QueueType.SOLVER); this.clusterQueues = queueService.getQueueGroup(QueueType.CLUSTER); }
@Inject private TaskService(ClusterStoreService clusterStoreService, CredentialStore credentialStore, ServerStats serverStats, QueueService queueService, IdService idService, Gson gson) { this.clusterStore = clusterStoreService.getSystemView(); this.credentialStore = credentialStore; this.serverStats = serverStats; this.idService = idService; this.gson = gson; this.callbackQueues = queueService.getQueueGroup(QueueType.CALLBACK); }
@Inject private CallbackScheduler(@Named("scheduler.id") String id, @Named("callback.executor.service") ListeningExecutorService executorService, TaskService taskService, ClusterCallback clusterCallback, Configuration conf, ClusterStoreService clusterStoreService, UserStore userStore, Gson gson, QueueService queueService) { this.id = id; this.executorService = executorService; this.taskService = taskService; this.clusterCallback = clusterCallback; this.clusterCallback.initialize(conf); this.gson = gson; this.callbackQueues = queueService.getQueueGroup(QueueType.CALLBACK); this.jobQueues = queueService.getQueueGroup(QueueType.JOB); this.clusterStoreService = clusterStoreService; this.userStore = userStore; }
@Inject private JobScheduler(ClusterStoreService clusterStoreService, QueueService queueService, LockService lockService, TaskService taskService, Configuration conf, Gson gson) { this.clusterStore = clusterStoreService.getSystemView(); this.lockService = lockService; this.taskService = taskService; this.maxTaskRetries = conf.getInt(Constants.MAX_ACTION_RETRIES); this.gson = gson; this.jobQueues = queueService.getQueueGroup(QueueType.JOB); this.provisionerQueues = queueService.getQueueGroup(QueueType.PROVISIONER); }
this.credentialStore = credentialStore; this.serverStats = serverStats; this.taskQueues = queueService.getQueueGroup(QueueType.PROVISIONER); this.jobQueues = queueService.getQueueGroup(QueueType.JOB); this.tenantStore = tenantStore; this.gson = gson;
@Inject private ClusterCleanup(ClusterStoreService clusterStoreService, ClusterService clusterService, NodeService nodeService, TaskService taskService, QueueService queueService, Configuration conf) { this(clusterStoreService.getSystemView(), clusterService, nodeService, taskService, queueService.getQueueGroup(QueueType.JOB), queueService.getQueueGroup(QueueType.PROVISIONER), conf.getLong(Constants.TASK_TIMEOUT_SECS), conf.getLong(Constants.ID_START_NUM), conf.getLong(Constants.ID_INCREMENT_BY)); }
@BeforeClass public static void setupTestClass() { service = injector.getInstance(TaskQueueService.class); provisionerQueues = queueService.getQueueGroup(QueueType.PROVISIONER); }
@BeforeClass public static void setupServiceBase() throws Exception { balancerQueue = injector.getInstance(Key.get(TrackingQueue.class, Names.named(Constants.Queue.WORKER_BALANCE))); provisionerQueues = queueService.getQueueGroup(QueueType.PROVISIONER); clusterQueues = queueService.getQueueGroup(QueueType.CLUSTER); solverQueues = queueService.getQueueGroup(QueueType.SOLVER); jobQueues = queueService.getQueueGroup(QueueType.JOB); callbackQueues = queueService.getQueueGroup(QueueType.CALLBACK); internalHandlerServer = injector.getInstance(InternalHandlerServer.class); internalHandlerServer.startAndWait(); internalPort = internalHandlerServer.getBindAddress().getPort(); externalHandlerServer = injector.getInstance(ExternalHandlerServer.class); externalHandlerServer.startAndWait(); externalPort = externalHandlerServer.getBindAddress().getPort(); tenantProvisionerService = injector.getInstance(TenantProvisionerService.class); internalBase = "http://" + HOSTNAME + ":" + internalPort + Constants.API_BASE; externalBase = "http://" + HOSTNAME + ":" + externalPort + Constants.API_BASE; }
@BeforeClass public static void setupSchedulerTest() throws Exception { solverQueues = queueService.getQueueGroup(QueueType.SOLVER); clusterQueues = queueService.getQueueGroup(QueueType.CLUSTER); solverScheduler = injector.getInstance(SolverScheduler.class);