public class ClusterManagerImpl extends Object implements ClusterManager, SimpleRMI.ServerListener, ClusterPreferencesChangeListener, NodeTracker.NodeEventListener
Modifier and Type | Method and Description |
---|---|
void |
addContainersToAppMaster(JobInformation jobInfo,
List<ContainerDescriptor> containers)
Add descriptors of containers that are allocated to the application master.
|
void |
addListener(ClusterManagerListener listener) |
String |
allocateMaster(GUID jobGUID)
Allocates the master node for the given job
|
NodeAllocationPlan |
allocateWorkers(GUID jobGUID)
Allocates the worker nodes for the given job
|
void |
checkStatus() |
void |
clearClasspathCache()
Clears the shared classpath cache
|
void |
deregisterAppMaster(JobInformation jobInfo)
Deregister an external application master.
|
void |
destroy()
Called upon server shutdown.
|
void |
ensureRegistered(NodeDescriptor node)
Adds a node to the cluster registry.
|
void |
failJob(GUID jobGUID)
Manually force job fail
|
List<MasterDescriptor> |
getActiveAppMasters()
Get a list of active (external) application masters.
|
List<JobInformation> |
getAllocatedJobs() |
InetSocketAddress |
getClusterAddress() |
ClusterPreferences |
getConfiguration()
Get the global cluster configuration (not for a specific node).
|
ClusterPreferences |
getConfiguration(String node)
Requests the configuration for the given node.
|
List<ContainerDescriptor> |
getContainers(MasterDescriptor masterDescriptor)
Get the list of containers allocated to an application master.
|
ExecutorOptions |
getDefaultOptions()
Gets the default options configured for remote fragment
execution.
|
protected Integer |
getJobServiceStatus(GUID jobGUID,
WorkerRole role) |
Integer |
getJobStatus(GUID jobGUID)
Get the general run status of the job
-1 - job in progress
0 - job completed normally
1+ - job has errors
|
NodeDescriptor |
getNodeDescriptor(String name)
Gets the node descriptor for the specified node
|
NodeMapping |
getNodes(boolean refresh)
Gets node info for all nodes in the cluster
|
List<MasterDescriptor> |
getPendingAppMasters()
Get a list of pending (external) application masters.
|
List<NodeAllocationRequest> |
getPendingJobs() |
String |
getStatus()
Gets a description of the current status of the node
|
String |
getVersion()
Returns the version number of this ClusterManager instance
|
void |
init(GenericTCPServer.ServerContext context)
Called upon server start to inform the handler of context information
such as the listening address.
|
String |
initializeNodeAllocation(SerializationBridge<NodeAllocationRequest> request) |
void |
jobFinished(JobStatistics statistics)
Called by command server upon exit to report final statistics
|
void |
killJob(GUID jobGUID)
Administrative job kill
|
void |
nodeStarted(NodeDescriptor node) |
InputStream |
openClusterLogFile(LogFileOptions options)
Opens the log file for cluster manager for reading
|
void |
preferencesChanged(ClusterPreferenceChangeEvent e)
Event fired to indicate change of cluster preferences
|
void |
registerAppMaster(MasterDescriptor masterDescriptor)
Register an application master started outside of the context of the cluster manager.
|
void |
removeListener(ClusterManagerListener listener) |
void |
rotateClusterLog()
Rotates the cluster manager log
|
void |
rotateNodeLogs()
Rotates all of the node manager logs
|
void |
shutdown()
Requests a shutdown of the cluster.
|
void |
shutdownNode(String name)
Shuts down the given node.
|
static ClusterManagerImpl |
start(ClusterPreferencesProvider prefProvider,
int port,
boolean daemon,
String ipaddress) |
public void checkStatus()
public InetSocketAddress getClusterAddress()
public ExecutorOptions getDefaultOptions()
ClusterManager
getDefaultOptions
in interface ClusterManager
public void nodeStarted(NodeDescriptor node)
nodeStarted
in interface NodeTracker.NodeEventListener
public NodeMapping getNodes(boolean refresh)
ClusterManager
getNodes
in interface ClusterManager
refresh
- if true, pings each node to ensure that it only returns live nodespublic void ensureRegistered(NodeDescriptor node)
ClusterManager
ensureRegistered
in interface ClusterManager
node
- the node informationpublic NodeDescriptor getNodeDescriptor(String name)
ClusterManager
getNodeDescriptor
in interface ClusterManager
name
- the name of the node requestedpublic ClusterPreferences getConfiguration() throws RMIException
ClusterManager
getConfiguration
in interface ClusterManager
RMIException
- thrown for communication errorspublic void registerAppMaster(MasterDescriptor masterDescriptor) throws RMIException
ClusterManager
registerAppMaster
in interface ClusterManager
masterDescriptor
- descriptor of the application masterRMIException
- thrown for communication errorspublic void deregisterAppMaster(JobInformation jobInfo) throws RMIException
ClusterManager
deregisterAppMaster
in interface ClusterManager
RMIException
- thrown for communication errorspublic List<MasterDescriptor> getPendingAppMasters() throws RMIException
ClusterManager
getPendingAppMasters
in interface ClusterManager
RMIException
- throw for communication errorspublic List<MasterDescriptor> getActiveAppMasters() throws RMIException
ClusterManager
getActiveAppMasters
in interface ClusterManager
RMIException
- throw for communication errorspublic void addContainersToAppMaster(JobInformation jobInfo, List<ContainerDescriptor> containers) throws RMIException
ClusterManager
addContainersToAppMaster
in interface ClusterManager
containers
- containers allocated to the application masterRMIException
- thrown for communication errorspublic List<ContainerDescriptor> getContainers(MasterDescriptor masterDescriptor) throws RMIException
ClusterManager
getContainers
in interface ClusterManager
masterDescriptor
- application masterRMIException
- throws for communication errorspublic void shutdown()
ClusterManager
shutdown
in interface ClusterManager
public void addListener(ClusterManagerListener listener)
public void removeListener(ClusterManagerListener listener)
public static ClusterManagerImpl start(ClusterPreferencesProvider prefProvider, int port, boolean daemon, String ipaddress)
public String getStatus()
ClusterManager
getStatus
in interface ClusterManager
public void init(GenericTCPServer.ServerContext context)
SimpleRMI.ServerListener
init
in interface SimpleRMI.ServerListener
context
- the server contextpublic void destroy()
SimpleRMI.ServerListener
destroy
in interface SimpleRMI.ServerListener
public ClusterPreferences getConfiguration(String node)
ClusterManager
getConfiguration
in interface ClusterManager
node
- the node requesting the configurationpublic void preferencesChanged(ClusterPreferenceChangeEvent e)
ClusterPreferencesChangeListener
preferencesChanged
in interface ClusterPreferencesChangeListener
e
- the change eventpublic void jobFinished(JobStatistics statistics)
JobHistoryService
jobFinished
in interface JobHistoryService
statistics
- the final statisticspublic InputStream openClusterLogFile(LogFileOptions options) throws IOException
ClusterManager
openClusterLogFile
in interface ClusterManager
IOException
public void killJob(GUID jobGUID)
ClusterManager
killJob
in interface ClusterManager
public void failJob(GUID jobGUID)
ClusterManager
failJob
in interface ClusterManager
public Integer getJobStatus(GUID jobGUID)
ClusterManager
getJobStatus
in interface ClusterManager
protected Integer getJobServiceStatus(GUID jobGUID, WorkerRole role)
public void clearClasspathCache() throws RMIException, IOException
ClusterManager
clearClasspathCache
in interface ClusterManager
IOException
- if unable to delete (would typically happen if job is running). Generally we don't care so much about
cleanup failures, but here we need to let the user know because otherwise case may still be dirty.RMIException
public String getVersion()
ClusterManager
getVersion
in interface ClusterManager
public void shutdownNode(String name) throws RMIException
ClusterManager
shutdownNode
in interface ClusterManager
name
- the entry to removeRMIException
public void rotateClusterLog() throws RMIException
ClusterManager
rotateClusterLog
in interface ClusterManager
RMIException
public void rotateNodeLogs() throws RMIException, IOException
ClusterManager
rotateNodeLogs
in interface ClusterManager
RMIException
IOException
- if unable to rotatepublic String initializeNodeAllocation(SerializationBridge<NodeAllocationRequest> request)
initializeNodeAllocation
in interface ClusterManager
public String allocateMaster(GUID jobGUID)
ClusterManager
allocateMaster
in interface ClusterManager
public NodeAllocationPlan allocateWorkers(GUID jobGUID)
ClusterManager
allocateWorkers
in interface ClusterManager
public List<JobInformation> getAllocatedJobs()
getAllocatedJobs
in interface ClusterManager
public List<NodeAllocationRequest> getPendingJobs()
getPendingJobs
in interface ClusterManager
Copyright © 2016 Actian Corporation. All Rights Reserved.