public MasterMain(final CuratorClientFactory curatorClientFactory, final MasterParser parser) { this(curatorClientFactory, parser.getMasterConfig(), parser.getLoggingConfig() ); }
public MasterMain(final CuratorClientFactory curatorClientFactory, final MasterConfig masterConfig, final LoggingConfig loggingConfig) { super(loggingConfig, masterConfig.getSentryDsn()); this.masterConfig = masterConfig; this.curatorClientFactory = curatorClientFactory; }
/** * Given a jobId, returns the N most recent events in its history in the cluster. */ @Override public List<TaskStatusEvent> getJobHistory(final JobId jobId) throws JobDoesNotExistException { return getJobHistory(jobId, null); }
@Override protected void startUp() throws Exception { service = new MasterService(masterConfig, createEnvironment("helios-master"), curatorClientFactory ); service.startAsync().awaitRunning(); }
@Override public List<String> getDeploymentGroupHosts(final String name) throws DeploymentGroupDoesNotExistException { log.debug("getting deployment group hosts: {}", name); final ZooKeeperClient client = provider.get("getDeploymentGroupHosts"); final DeploymentGroup deploymentGroup = getDeploymentGroup(client, name); if (deploymentGroup == null) { throw new DeploymentGroupDoesNotExistException(name); } return getHosts(client, Paths.statusDeploymentGroupHosts(name)); }
public MasterMain(final CuratorClientFactory curatorClientFactory, final String[] args) throws ArgumentParserException { this(curatorClientFactory, new MasterParser(args)); }
private Map<String, String> getLabels(final ZooKeeperClient client, final String host) { return tryGetEntity(client, Paths.statusHostLabels(host), STRING_MAP_TYPE, "labels"); }
/** * forceRollingUpdateUndeploy is used to undeploy jobs from hosts that have been removed from the * deployment group. It disables the 'skipRedundantUndeploys' flag, which disables the * redundantDeployment() check. */ private RollingUpdateOp forceRollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, false); }
@Override Iterable<String> collectItems() { return masterModel.listHosts(); }
@Override public Deployment undeployJob(String host, JobId jobId) throws HostNotFoundException, JobNotDeployedException { try { return undeployJob(host, jobId, Job.EMPTY_TOKEN); } catch (TokenVerificationException e) { throw new RuntimeException(e); } }
@Override public void run(final boolean timeout) throws InterruptedException { try { masterModel.rollingUpdateStep(); } catch (Exception e) { log.error("error processing rolling update step: {}", e); } } }
@Override public void updateDeployment(String host, Deployment deployment) throws HostNotFoundException, JobNotDeployedException { try { updateDeployment(host, deployment, Job.EMPTY_TOKEN); } catch (TokenVerificationException e) { throw new RuntimeException(e); } }
@Override public Job removeJob(JobId jobId) throws JobDoesNotExistException, JobStillDeployedException { try { return removeJob(jobId, Job.EMPTY_TOKEN); } catch (TokenVerificationException e) { throw new RuntimeException(e); } }
@Override public void deployJob(String host, Deployment job) throws HostNotFoundException, JobAlreadyDeployedException, JobDoesNotExistException, JobPortAllocationConflictException { try { deployJob(host, job, Job.EMPTY_TOKEN); } catch (TokenVerificationException e) { throw new RuntimeException(e); } }
@Override Iterable<Job> collectItems() { return masterModel.getJobs().values(); }
/** * Creates a config entry within the specified agent to un/deploy a job, or more generally, change * the deployment status according to the {@code Goal} value in {@link Deployment}. */ @Override public void deployJob(final String host, final Deployment deployment, final String token) throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException, JobPortAllocationConflictException, TokenVerificationException { final ZooKeeperClient client = provider.get("deployJob"); deployJobRetry(client, host, deployment, 0, token); }
@Override public AgentInfo getAgentInfo(final String host) { return getAgentInfo(provider.get("getAgentInfo"), host); }
@Override protected void shutDown() throws Exception { service.stopAsync().awaitTerminated(); }
public MasterMain(final String[] args) throws ArgumentParserException { this(new CuratorClientFactoryImpl(), new MasterParser(args)); }
private HostInfo getHostInfo(final ZooKeeperClient client, final String host) { return tryGetEntity(client, Paths.statusHostInfo(host), HOST_INFO_TYPE, "host info"); }