Class GridEngineNodeDiscovery

java.lang.Object
com.scivicslab.pojoactor.core.distributed.discovery.GridEngineNodeDiscovery
All Implemented Interfaces:
NodeDiscovery

public class GridEngineNodeDiscovery extends Object implements 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 nodes
  • SGE_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 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: NodeDiscovery
      Checks if this discovery implementation is applicable to the current environment.
      Specified by:
      isApplicable in interface NodeDiscovery
      Returns:
      true if this discovery can be used in current environment
    • getMyNodeId

      public String getMyNodeId()
      Description copied from interface: NodeDiscovery
      Returns the unique identifier for the current node.
      Specified by:
      getMyNodeId in interface NodeDiscovery
      Returns:
      the node ID
    • getMyHost

      public String getMyHost()
      Description copied from interface: NodeDiscovery
      Returns the hostname or IP address for the current node.
      Specified by:
      getMyHost in interface NodeDiscovery
      Returns:
      the host address
    • getMyPort

      public int getMyPort()
      Description copied from interface: NodeDiscovery
      Returns the default port number for actor communication.

      This can be overridden by the user if needed.

      Specified by:
      getMyPort in interface NodeDiscovery
      Returns:
      the port number
    • getAllNodes

      public List<NodeInfo> getAllNodes()
      Description copied from interface: NodeDiscovery
      Returns information about all nodes in the cluster.

      This includes the current node and all remote nodes.

      Specified by:
      getAllNodes in interface NodeDiscovery
      Returns:
      list of all node information