g-Eclipse
Release 1.0.0

eu.geclipse.batch.pbs
Class PBSBatchService

java.lang.Object
  extended by eu.geclipse.batch.AbstractBatchService
      extended by eu.geclipse.batch.pbs.PBSBatchService
All Implemented Interfaces:
IBatchService

public final class PBSBatchService
extends AbstractBatchService

Class for executing PBS commands on a Computing Element.


Constructor Summary
PBSBatchService(IBatchServiceDescription description, java.lang.String name)
          Create a new PBSWrapper.
 
Method Summary
 boolean connectToServer(ISSHConnectionInfo sshConnectionInfo)
          Establishes a ssh-connection to the server running the PBS service.
 void createQueue(DocumentRoot documentRoot)
          Executes command that will create a new queue with the root element of a Queue Description Language (QDL) document and argument.
 void createQueue(java.lang.String queueName, int priority, IQueueInfo.QueueType type, boolean enabled, boolean started, int maxRunningJobs, double timeCPU, double timeWall, int maxJobsInQueue, int assignedResources, java.util.List<java.lang.String> vos)
          Executes command that will create a new queue with a "default" number of argument.
 void createQueue(java.lang.String queueName, IQueueInfo.QueueType type, boolean enabled, double timeCPU, double timeWall, java.util.List<java.lang.String> vos)
          Executes command that will create a new queue with minimum arguments.
 void delJob(java.lang.String jobId)
          Executes qdel on the PBS server and returns if the command was executed of not.
 void delQueue(java.lang.String queueId)
          Deletes the specified queue.
 void disableQueue(java.lang.String queueId)
          Executes qdisable to disable a specific queue.
 void disableQueues(java.lang.String[] queueIds)
          Executes qdisable to disable all specified queues.
 void disableWN(java.lang.String nodeId)
          Changes the state of a workernode to offline, no jobs will be placed on this workernode.
 void enableQueue(java.lang.String queueId)
          Executes qenable to enable a specific queue.
 void enableQueues(java.lang.String[] queueIds)
          Executes qenable to enable all specified queues.
 void enableWN(java.lang.String nodeId)
          Changes the state of a workernode to free, jobs will be placed on this workernode.
 void getJobs(IBatchJobManager manager)
          Executes qstat on the PBS server and returns a list of the jobs as BatchJobInfo.
 java.util.List<IQueueInfo> getQueues()
          Executes qstat -q on the PBS server and returns a list of the queues as QueueInfo.
 java.util.List<IWorkerNodeInfo> getWorkerNodes()
          Executes pbsnodes on the PBS server and returns a list of the workernodes as WorkerNodeInfo.
 void holdJob(java.lang.String jobId)
          Puts a hold on a job in the queue of the batch service.
 void holdJobs(java.lang.String[] jobIds)
          Puts a hold on one or more jobs in the queue of the batch service.
 void moveJob(java.lang.String jobId, java.lang.String destQueue, java.lang.String destServer)
          Executes qmove on the PBS server and returns if the command was executed of not.
 void moveJobs(java.lang.String[] jobIds, java.lang.String destQueue, java.lang.String destServer)
          Executes qmove on the PBS server and returns if the command was executed of not.
 void releaseJob(java.lang.String jobId)
          Release a job with a previous hold in queue of the batch system.
 void releaseJobs(java.lang.String[] jobIds)
          Release one or more jobs with a previous hold in queue of the batch system.
 void reRunJob(java.lang.String jobId)
          Rerun a currently running job.
 void reRunJobs(java.lang.String[] jobIds)
          Rerun one or more currently running jobs.
 void setMaxWallTime(java.lang.String queueName, java.lang.String timeWall)
          Executes command that will change the maximum allowed wall time of a specific queue.
 void startQueue(java.lang.String queueId)
          Executes qstart to start a specific queue.
 void startQueues(java.lang.String[] queueIds)
          Executes qstart to start all specified queues.
 void stopQueue(java.lang.String queueId)
          Executes qstop to stop a specific queue.
 void stopQueues(java.lang.String[] queueIds)
          Executes qstop to stop all specified queues.
 
Methods inherited from class eu.geclipse.batch.AbstractBatchService
disconnectFromServer, getDescription, getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBSBatchService

public PBSBatchService(IBatchServiceDescription description,
                       java.lang.String name)
Create a new PBSWrapper.

Parameters:
description - The IBatchServiceDescription from which this service should be created.
name - batch service name, i.e. the configuration file that were used to instantiate this service
Method Detail

connectToServer

public boolean connectToServer(ISSHConnectionInfo sshConnectionInfo)
                        throws ProblemException
Establishes a ssh-connection to the server running the PBS service.

Specified by:
connectToServer in interface IBatchService
Overrides:
connectToServer in class AbstractBatchService
Parameters:
sshConnectionInfo - Holding the information needed to establish a ssh connection with the PBS server.
Returns:
Returns true if the connection is established, false otherwise.
Throws:
ProblemException - If the ssh connection cannot be established

getJobs

public void getJobs(IBatchJobManager manager)
             throws ProblemException
Executes qstat on the PBS server and returns a list of the jobs as BatchJobInfo. If no jobs are running or error parsing the output then this method will return null. The output of qstat are as follows: Job id Name User Time Use S Queue ------------------- ---------------- --------------- -------- - ----- 968.ce201 blahjob_KJ8465 see001 0 R see 969.ce201 blahjob_RT8482 see001 0 R see

Parameters:
manager - The manager where the jobs will be merged into.
Throws:
ProblemException - If command is not executed successfully

delJob

public void delJob(java.lang.String jobId)
            throws ProblemException
Executes qdel on the PBS server and returns if the command was executed of not.

Parameters:
jobId - The identifier of the job to be deleted.
Throws:
ProblemException - If command is not executed successfully

moveJob

public void moveJob(java.lang.String jobId,
                    java.lang.String destQueue,
                    java.lang.String destServer)
             throws ProblemException
Executes qmove on the PBS server and returns if the command was executed of not.

Parameters:
jobId - The identifier of the job to be moved.
destQueue - The destination queue, null if no destination queue.
destServer - The destination server, null if no destination server.
Throws:
ProblemException - If command is not executed successfully

moveJobs

public void moveJobs(java.lang.String[] jobIds,
                     java.lang.String destQueue,
                     java.lang.String destServer)
              throws ProblemException
Executes qmove on the PBS server and returns if the command was executed of not.

Parameters:
jobIds - The identifier of the jobs to be moved.
destQueue - The destination queue, null if no destination queue.
destServer - The destination server, null if no destination server.
Throws:
ProblemException - If command is not executed successfully

holdJob

public void holdJob(java.lang.String jobId)
             throws ProblemException
Puts a hold on a job in the queue of the batch service.

Parameters:
jobId - The identifier of the job to be held.
Throws:
ProblemException - If command is not executed successfully

holdJobs

public void holdJobs(java.lang.String[] jobIds)
              throws ProblemException
Puts a hold on one or more jobs in the queue of the batch service.

Parameters:
jobIds - The identifiers of the jobs to be held.
Throws:
ProblemException - If command is not executed successfully

releaseJob

public void releaseJob(java.lang.String jobId)
                throws ProblemException
Release a job with a previous hold in queue of the batch system.

Parameters:
jobId - The identifier of the job to be released.
Throws:
ProblemException - If command is not executed successfully

releaseJobs

public void releaseJobs(java.lang.String[] jobIds)
                 throws ProblemException
Release one or more jobs with a previous hold in queue of the batch system.

Parameters:
jobIds - The identifiers of the jobs to be released.
Throws:
ProblemException - If command is not executed successfully

reRunJob

public void reRunJob(java.lang.String jobId)
              throws ProblemException
Rerun a currently running job.

Parameters:
jobId - The identifier of the job to be rerun.
Throws:
ProblemException - If command is not executed successfully

reRunJobs

public void reRunJobs(java.lang.String[] jobIds)
               throws ProblemException
Rerun one or more currently running jobs.

Parameters:
jobIds - The identifiers of the jobs to be rerun.
Throws:
ProblemException - If command is not executed successfully

getWorkerNodes

public java.util.List<IWorkerNodeInfo> getWorkerNodes()
                                               throws ProblemException
Executes pbsnodes on the PBS server and returns a list of the workernodes as WorkerNodeInfo. If no workernodes or error parsing the output then this method will return null. The output of pbsnodes are as follows: wn201.grid.ucy.ac.cy state = free np = 1 properties = lcgpro ntype = cluster status = opsys=linux,uname=Linux wn201.grid.ucy.ac.cy 2.4.21-47.0.1.EL #1 Thu Oct 19 11:02:51 CDT 2006 i686, sessions=? 0,nsessions=? 0,nusers=0,idletime=1268300,totmem=1821164kb,availmem=1716700kb, physmem=768916kb,ncpus=1,loadave=0.00,netload=637790691,state=free,jobs=? 0,rectime=1180422371

Returns:
A List of WorkerNodeInfo or null.
Throws:
ProblemException - If command is not executed successfully

disableWN

public void disableWN(java.lang.String nodeId)
               throws ProblemException
Changes the state of a workernode to offline, no jobs will be placed on this workernode.

Parameters:
nodeId - The identifier of the node to be disabled.
Throws:
ProblemException - If command is not executed successfully

enableWN

public void enableWN(java.lang.String nodeId)
              throws ProblemException
Changes the state of a workernode to free, jobs will be placed on this workernode.

Parameters:
nodeId - The identifier of the node to be enabled.
Throws:
ProblemException - If command is not executed successfully

getQueues

public java.util.List<IQueueInfo> getQueues()
                                     throws ProblemException
Executes qstat -q on the PBS server and returns a list of the queues as QueueInfo. If no queues or error parsing the output then this method will return null. The output of qstat -q are as follows: server: ce201.grid.ucy.ac.cy Queue Memory CPU Time Walltime Node Run Que Lm State ---------------- ------ -------- -------- ---- --- --- -- ----- dteam -- 48:00:00 72:00:00 -- 0 0 -- E R see -- 48:00:00 72:00:00 -- 0 0 -- E R geclipse -- 48:00:00 72:00:00 -- 0 0 -- E R ops -- 48:00:00 72:00:00 -- 0 0 -- E R ----- ----- 0 0

Returns:
A List of QueueInfo or null.
Throws:
ProblemException - If command is not executed successfully

disableQueue

public void disableQueue(java.lang.String queueId)
                  throws ProblemException
Executes qdisable to disable a specific queue.

Parameters:
queueId - The identifier of the queue to be disable.
Throws:
ProblemException - If command is not executed successfully

disableQueues

public void disableQueues(java.lang.String[] queueIds)
                   throws ProblemException
Executes qdisable to disable all specified queues.

Parameters:
queueIds - The identifiers of the queues to be disable.
Throws:
ProblemException - If command is not executed successfully

enableQueue

public void enableQueue(java.lang.String queueId)
                 throws ProblemException
Executes qenable to enable a specific queue.

Parameters:
queueId - The identifier of the queue to be enabled.
Throws:
ProblemException - If command is not executed successfully

enableQueues

public void enableQueues(java.lang.String[] queueIds)
                  throws ProblemException
Executes qenable to enable all specified queues.

Parameters:
queueIds - The identifiers of the queues to be enabled.
Throws:
ProblemException - If command is not executed successfully

startQueue

public void startQueue(java.lang.String queueId)
                throws ProblemException
Executes qstart to start a specific queue.

Parameters:
queueId - The identifier of the queue to be started.
Throws:
ProblemException - If command is not executed successfully

startQueues

public void startQueues(java.lang.String[] queueIds)
                 throws ProblemException
Executes qstart to start all specified queues.

Parameters:
queueIds - The identifiers of the queues to be started.
Throws:
ProblemException - If command is not executed successfully

stopQueue

public void stopQueue(java.lang.String queueId)
               throws ProblemException
Executes qstop to stop a specific queue.

Parameters:
queueId - The identifier of the queue to be stopped.
Throws:
ProblemException - If command is not executed successfully

stopQueues

public void stopQueues(java.lang.String[] queueIds)
                throws ProblemException
Executes qstop to stop all specified queues.

Parameters:
queueIds - The identifiers of the queues to be stopped.
Throws:
ProblemException - If command is not executed successfully

createQueue

public void createQueue(java.lang.String queueName,
                        IQueueInfo.QueueType type,
                        boolean enabled,
                        double timeCPU,
                        double timeWall,
                        java.util.List<java.lang.String> vos)
                 throws ProblemException
Executes command that will create a new queue with minimum arguments.

Parameters:
queueName - The name of the new queue.
type - The type of the new queue.
enabled - The state of the new queue.
timeCPU - Maximum allowed CPU time for any job.
timeWall - Maximum allowed wall time for any job.
vos - Only allow access to the specified vos, null no restriction is applied.
Throws:
ProblemException - If command is not executed successfully

createQueue

public void createQueue(java.lang.String queueName,
                        int priority,
                        IQueueInfo.QueueType type,
                        boolean enabled,
                        boolean started,
                        int maxRunningJobs,
                        double timeCPU,
                        double timeWall,
                        int maxJobsInQueue,
                        int assignedResources,
                        java.util.List<java.lang.String> vos)
                 throws ProblemException
Executes command that will create a new queue with a "default" number of argument.

Parameters:
queueName - The name of the new queue.
priority - The priority of the new queue.
type - The type of the new queue.
enabled - The state of the new queue.
started - If the new queue will be started when created.
maxRunningJobs - Maximum running jobs at any given time from the queue.
timeCPU - Maximum allowed CPU time for any job.
timeWall - Maximum allowed wall time for any job.
maxJobsInQueue - Maximum allowed jobs in the queue
assignedResources -
vos - Only allow access to the specified vos, null no restriction is applied.
Throws:
ProblemException - If command is not executed successfully

setMaxWallTime

public void setMaxWallTime(java.lang.String queueName,
                           java.lang.String timeWall)
                    throws ProblemException
Executes command that will change the maximum allowed wall time of a specific queue.

Parameters:
queueName - The name of the queue to be modified.
timeWall - The new maximum allowed wall time for any job.
Throws:
ProblemException - If command is not executed successfully

delQueue

public void delQueue(java.lang.String queueId)
              throws ProblemException
Deletes the specified queue.

Parameters:
queueId - The identifier of the queue to be deleted.
Throws:
ProblemException - If command is not executed successfully

createQueue

public void createQueue(DocumentRoot documentRoot)
                 throws ProblemException
Description copied from interface: IBatchService
Executes command that will create a new queue with the root element of a Queue Description Language (QDL) document and argument.

Parameters:
documentRoot - The root element of a QDL document.
Throws:
ProblemException

g-Eclipse
Release 1.0.0