public class ZooKeeperMasterModel extends Object implements MasterModel
| Modifier and Type | Field and Description |
|---|---|
static com.fasterxml.jackson.core.type.TypeReference<com.spotify.helios.common.descriptors.AgentInfo> |
AGENT_INFO_TYPE |
static Map<com.spotify.helios.common.descriptors.JobId,com.spotify.helios.common.descriptors.TaskStatus> |
EMPTY_STATUSES |
static com.fasterxml.jackson.core.type.TypeReference<com.spotify.helios.common.descriptors.HostInfo> |
HOST_INFO_TYPE |
static com.fasterxml.jackson.core.type.TypeReference<List<String>> |
STRING_LIST_TYPE |
static com.fasterxml.jackson.core.type.TypeReference<Map<String,String>> |
STRING_MAP_TYPE |
| Constructor and Description |
|---|
ZooKeeperMasterModel(ZooKeeperClientProvider provider,
String name,
List<EventSender> eventSenders,
String deploymentGroupEventTopic)
Constructor.
|
public static final Map<com.spotify.helios.common.descriptors.JobId,com.spotify.helios.common.descriptors.TaskStatus> EMPTY_STATUSES
public static final com.fasterxml.jackson.core.type.TypeReference<com.spotify.helios.common.descriptors.HostInfo> HOST_INFO_TYPE
public static final com.fasterxml.jackson.core.type.TypeReference<com.spotify.helios.common.descriptors.AgentInfo> AGENT_INFO_TYPE
public static final com.fasterxml.jackson.core.type.TypeReference<Map<String,String>> STRING_MAP_TYPE
public ZooKeeperMasterModel(ZooKeeperClientProvider provider, String name, List<EventSender> eventSenders, String deploymentGroupEventTopic)
provider - ZooKeeperClientProvidername - The hostname of the machine running the MasterModeleventSenders - EventSenderpublic void registerHost(String host, String id)
id is initially generated randomly by the Agent
and persisted on disk. This way, in the event that you have two agents attempting to register
with the same value of @{code host}, the first one will win.registerHost in interface MasterModelpublic List<String> listHosts()
listHosts in interface MasterModelpublic List<String> getRunningMasters()
getRunningMasters in interface MasterModelpublic void deregisterHost(String host) throws HostNotFoundException, HostStillInUseException
registerHost(String, String). Cleans up
any leftover host-related things.deregisterHost in interface MasterModelHostNotFoundExceptionHostStillInUseExceptionpublic void addJob(com.spotify.helios.common.descriptors.Job job) throws JobExistsException
addJob in interface MasterModelJobExistsExceptionpublic List<com.spotify.helios.common.descriptors.TaskStatusEvent> getJobHistory(com.spotify.helios.common.descriptors.JobId jobId) throws JobDoesNotExistException
getJobHistory in interface MasterModelJobDoesNotExistExceptionpublic List<com.spotify.helios.common.descriptors.TaskStatusEvent> getJobHistory(com.spotify.helios.common.descriptors.JobId jobId, String host) throws JobDoesNotExistException
getJobHistory in interface MasterModelJobDoesNotExistExceptionpublic void addDeploymentGroup(com.spotify.helios.common.descriptors.DeploymentGroup deploymentGroup) throws DeploymentGroupExistsException
If successful, the following ZK nodes will be created:
If the operation fails no ZK nodes will be created. If any of the nodes above already exist the operation will fail.
addDeploymentGroup in interface MasterModelDeploymentGroupExistsException - If a DG with the same name already exists.public com.spotify.helios.common.descriptors.DeploymentGroup getDeploymentGroup(String name) throws DeploymentGroupDoesNotExistException
getDeploymentGroup in interface MasterModelDeploymentGroupDoesNotExistExceptionpublic void removeDeploymentGroup(String name) throws DeploymentGroupDoesNotExistException
If successful, all ZK nodes associated with the DG will be deleted. Specifically these nodes are guaranteed to be non-existent after a successful remove (not all of them might exist before, though):
removeDeploymentGroup in interface MasterModelDeploymentGroupDoesNotExistException - If the DG does not exist.public void updateDeploymentGroupHosts(String groupName, List<String> hosts) throws DeploymentGroupDoesNotExistException
updateDeploymentGroupHosts in interface MasterModelDeploymentGroupDoesNotExistExceptionpublic void rollingUpdate(com.spotify.helios.common.descriptors.DeploymentGroup deploymentGroup, com.spotify.helios.common.descriptors.JobId jobId, com.spotify.helios.common.descriptors.RolloutOptions options) throws DeploymentGroupDoesNotExistException, JobDoesNotExistException
rollingUpdate in interface MasterModelDeploymentGroupDoesNotExistExceptionJobDoesNotExistExceptionpublic void rollingUpdateStep()
rollingUpdateStep in interface MasterModelpublic void stopDeploymentGroup(String deploymentGroupName) throws DeploymentGroupDoesNotExistException
stopDeploymentGroup in interface MasterModelDeploymentGroupDoesNotExistExceptionpublic Map<String,com.spotify.helios.common.descriptors.DeploymentGroup> getDeploymentGroups()
Map of deployment group name to DeploymentGroup objects for all of
the deployment groups known.getDeploymentGroups in interface MasterModelpublic com.spotify.helios.common.descriptors.DeploymentGroupStatus getDeploymentGroupStatus(String name) throws DeploymentGroupDoesNotExistException
getDeploymentGroupStatus in interface MasterModelDeploymentGroupDoesNotExistExceptionpublic List<String> getDeploymentGroupHosts(String name) throws DeploymentGroupDoesNotExistException
getDeploymentGroupHosts in interface MasterModelDeploymentGroupDoesNotExistExceptionpublic com.spotify.helios.common.descriptors.Job getJob(com.spotify.helios.common.descriptors.JobId id)
id as a
Job object. A return value of null indicates the job doesn't exist.getJob in interface MasterModelpublic Map<com.spotify.helios.common.descriptors.JobId,com.spotify.helios.common.descriptors.Job> getJobs()
getJobs in interface MasterModelpublic com.spotify.helios.common.descriptors.JobStatus getJobStatus(com.spotify.helios.common.descriptors.JobId jobId)
JobStatus object.getJobStatus in interface MasterModelpublic com.spotify.helios.common.descriptors.Job removeJob(com.spotify.helios.common.descriptors.JobId jobId) throws JobDoesNotExistException, JobStillDeployedException
removeJob in interface MasterModelJobDoesNotExistExceptionJobStillDeployedExceptionpublic com.spotify.helios.common.descriptors.Job removeJob(com.spotify.helios.common.descriptors.JobId id, String token) throws JobDoesNotExistException, JobStillDeployedException, TokenVerificationException
removeJob in interface MasterModelJobDoesNotExistExceptionJobStillDeployedExceptionTokenVerificationExceptionpublic void deployJob(String host, com.spotify.helios.common.descriptors.Deployment job) throws HostNotFoundException, JobAlreadyDeployedException, JobDoesNotExistException, JobPortAllocationConflictException
deployJob in interface MasterModelHostNotFoundExceptionJobAlreadyDeployedExceptionJobDoesNotExistExceptionJobPortAllocationConflictExceptionpublic void deployJob(String host, com.spotify.helios.common.descriptors.Deployment deployment, String token) throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException, JobPortAllocationConflictException, TokenVerificationException
Goal value in Deployment.deployJob in interface MasterModelJobDoesNotExistExceptionJobAlreadyDeployedExceptionHostNotFoundExceptionJobPortAllocationConflictExceptionTokenVerificationExceptionpublic void updateDeployment(String host, com.spotify.helios.common.descriptors.Deployment deployment) throws HostNotFoundException, JobNotDeployedException
updateDeployment in interface MasterModelHostNotFoundExceptionJobNotDeployedExceptionpublic void updateDeployment(String host, com.spotify.helios.common.descriptors.Deployment deployment, String token) throws HostNotFoundException, JobNotDeployedException, TokenVerificationException
updateDeployment in interface MasterModelHostNotFoundExceptionJobNotDeployedExceptionTokenVerificationExceptionpublic com.spotify.helios.common.descriptors.Deployment getDeployment(String host, com.spotify.helios.common.descriptors.JobId jobId)
jobId on host.getDeployment in interface MasterModelpublic com.spotify.helios.common.descriptors.HostStatus getHostStatus(String host)
host.getHostStatus in interface MasterModelpublic Map<String,String> getHostLabels(String host)
MasterModelhost. Returns an empty map for hosts not found in the store.getHostLabels in interface MasterModelpublic boolean isHostUp(String host)
isHostUp in interface MasterModelpublic com.spotify.helios.common.descriptors.AgentInfo getAgentInfo(String host)
getAgentInfo in interface MasterModelpublic com.spotify.helios.common.descriptors.Deployment undeployJob(String host, com.spotify.helios.common.descriptors.JobId jobId) throws HostNotFoundException, JobNotDeployedException
undeployJob in interface MasterModelHostNotFoundExceptionJobNotDeployedExceptionpublic com.spotify.helios.common.descriptors.Deployment undeployJob(String host, com.spotify.helios.common.descriptors.JobId jobId, String token) throws HostNotFoundException, JobNotDeployedException, TokenVerificationException
jobId on host.undeployJob in interface MasterModelHostNotFoundExceptionJobNotDeployedExceptionTokenVerificationExceptionCopyright © 2017. All rights reserved.