Class GridEngineNodeDiscovery
java.lang.Object
com.scivicslab.pojoactor.core.distributed.discovery.GridEngineNodeDiscovery
- All Implemented Interfaces:
NodeDiscovery
Node discovery implementation for Grid Engine (SGE/UGE/OGE).
This implementation reads the Grid Engine PE_HOSTFILE to discover nodes in the parallel environment. It requires:
PE_HOSTFILE- Path to the hostfile listing allocated nodesSGE_TASK_ID- Task ID (for array jobs, optional)
The PE_HOSTFILE format is:
node01.cluster.local 4 all.q@node01.cluster.local UNDEFINED node02.cluster.local 4 all.q@node02.cluster.local UNDEFINED
Grid Engine Script Example
#!/bin/bash
#$ -pe mpi 10
#$ -cwd
# Launch one process per node
mpirun -np $NSLOTS java -jar myapp.jar --port=8080
Usage Example
public static void main(String[] args) {
NodeDiscovery discovery = new GridEngineNodeDiscovery();
if (!discovery.isApplicable()) {
System.err.println("Not running in Grid Engine environment");
System.exit(1);
}
DistributedActorSystem system = new DistributedActorSystem(
discovery.getMyNodeId(),
discovery.getMyHost(),
discovery.getMyPort()
);
// Register all remote nodes
for (NodeInfo node : discovery.getAllNodes()) {
if (!node.getNodeId().equals(discovery.getMyNodeId())) {
system.registerRemoteNode(
node.getNodeId(),
node.getHost(),
node.getPort()
);
}
}
}
- Since:
- 2.5.0
- Author:
- devteam@scivics-lab.com
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a GridEngineNodeDiscovery with default port 8080.GridEngineNodeDiscovery(int defaultPort) Constructs a GridEngineNodeDiscovery with specified port. -
Method Summary
Modifier and TypeMethodDescriptionReturns information about all nodes in the cluster.Returns the hostname or IP address for the current node.Returns the unique identifier for the current node.intReturns the default port number for actor communication.booleanChecks if this discovery implementation is applicable to the current environment.
-
Constructor Details
-
GridEngineNodeDiscovery
public GridEngineNodeDiscovery()Constructs a GridEngineNodeDiscovery with default port 8080. -
GridEngineNodeDiscovery
public GridEngineNodeDiscovery(int defaultPort) Constructs a GridEngineNodeDiscovery with specified port.- Parameters:
defaultPort- the default port for actor communication
-
-
Method Details
-
isApplicable
public boolean isApplicable()Description copied from interface:NodeDiscoveryChecks if this discovery implementation is applicable to the current environment.- Specified by:
isApplicablein interfaceNodeDiscovery- Returns:
- true if this discovery can be used in current environment
-
getMyNodeId
Description copied from interface:NodeDiscoveryReturns the unique identifier for the current node.- Specified by:
getMyNodeIdin interfaceNodeDiscovery- Returns:
- the node ID
-
getMyHost
Description copied from interface:NodeDiscoveryReturns the hostname or IP address for the current node.- Specified by:
getMyHostin interfaceNodeDiscovery- Returns:
- the host address
-
getMyPort
public int getMyPort()Description copied from interface:NodeDiscoveryReturns the default port number for actor communication.This can be overridden by the user if needed.
- Specified by:
getMyPortin interfaceNodeDiscovery- Returns:
- the port number
-
getAllNodes
Description copied from interface:NodeDiscoveryReturns information about all nodes in the cluster.This includes the current node and all remote nodes.
- Specified by:
getAllNodesin interfaceNodeDiscovery- Returns:
- list of all node information
-