dLife Home Page

dlife.tools.xgrid
Class XgridUtils

java.lang.Object
  extended by dlife.tools.xgrid.XgridUtils

public class XgridUtils
extends Object

This class contains a collection of general utility methods for use with the xgrid.

Version:
Jun 7, 2010
Author:
Grant Braught, Dickinson College

Constructor Summary
XgridUtils()
           
 
Method Summary
static void deleteAllJobs(String host, String password, String grid)
          Delete all of the jobs from the xgrid.
static void deleteJobs(String host, String password, String grid, ArrayList<String> jobIDs)
          Delete from the xgrid the jobs with the specified ids.
static ArrayList<String> getAllJobIDs(String host, String password, String grid)
          Get a list of all of the job id's for all of the jobs currently running on the xgrid.
static String getXgridCmdPrefix(String ghost, String gpass, String grid)
          This method produces the first part of the command line for executing an xgrid command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XgridUtils

public XgridUtils()
Method Detail

getXgridCmdPrefix

public static String getXgridCmdPrefix(String ghost,
                                       String gpass,
                                       String grid)
This method produces the first part of the command line for executing an xgrid command. It includes the host and password if they are specified. This method is included here because this functionality is required in many locations throughout the xgrid package.

Parameters:
ghost - the hostname of the grid controller . Can be null if the XGRID_CONTROLLER_HOSTNAME environment variable is set on the machine being used.
gpass - the password for the grid. Can be null if the XGRID_CONTROLLER_PASSWORD environment variable is set on the machine being used or the grid does not require a password.
grid - the name of the logical grid on which the command will be run. If this is null the command will be run on the default grid. Note: xgrid uses numeric gid's to identify the grids. This is not that id, it is the text name of the grid. This method will translate automatically to the xgrid gid value.
Returns:
the first part of the xgrid command line (e.g. xgrid -h the.host.name -p thepassword -gid thegid)

getAllJobIDs

public static ArrayList<String> getAllJobIDs(String host,
                                             String password,
                                             String grid)
Get a list of all of the job id's for all of the jobs currently running on the xgrid.

Parameters:
host - the hostname of the grid controller for which to get the list of job ids. Can be null if the XGRID_CONTROLLER_HOSTNAME environment variable is set on the machine being used.
password - the password for the grid. Can be null if the XGRID_CONTROLLER_PASSWORD environment variable is set on the machine being used or the grid does not require a password.
grid - the name of the logical grid on which the command will be run. If this is null the command will be run on the default grid. Note: xgrid uses numeric gid's to identify the grids. This is not that id, it is the text name of the grid. This method will translate automatically to the xgrid gid value.
Returns:
an ArrayList with one entry for each job id number.
Throws:
XgridCommunicationError - if there is an error communicating with the xgrid.

deleteJobs

public static void deleteJobs(String host,
                              String password,
                              String grid,
                              ArrayList<String> jobIDs)
                       throws XgridCommunicationError
Delete from the xgrid the jobs with the specified ids. If the jobs are running they are terminated. If the jobs are complete, their results are removed from the server.

Parameters:
host - the hostname of the grid controller from which to delete the jobs. Can be null if the XGRID_CONTROLLER_HOSTNAME environment variable is set on the machine being used.
password - the password for the grid. Can be null if the XGRID_CONTROLLER_PASSWORD environment variable is set on the machine being used or the grid does not require a password.
grid - the name of the logical grid on which the command will be run. If this is null the command will be run on the default grid. Note: xgrid uses numeric gid's to identify the grids. This is not that id, it is the text name of the grid. This method will translate automatically to the xgrid gid value.
jobIDs - a list of job id's of the jobs to be deleted.
Throws:
XgridCommunicationError - if there is an error communicating with the xgrid.

deleteAllJobs

public static void deleteAllJobs(String host,
                                 String password,
                                 String grid)
                          throws XgridCommunicationError
Delete all of the jobs from the xgrid. If the jobs are running they are terminated. If the jobs are complete, their results are removed from the server. Note: This removes ALL jobs from the xgrid server. So be careful if there are others users of the xgrid because this will delete their jobs as well as your own.

Parameters:
host - the hostname of the grid controller from which to delete the jobs. Can be null if the XGRID_CONTROLLER_HOSTNAME environment variable is set on the machine being used.
password - the password for the grid. Can be null if the XGRID_CONTROLLER_PASSWORD environment variable is set on the machine being used or the grid does not require a password.
grid - the name of the logical grid on which the command will be run. If this is null the command will be run on the default grid. Note: xgrid uses numeric gid's to identify the grids. This is not that id, it is the text name of the grid. This method will translate automatically to the xgrid gid value.
Throws:
XgridCommunicationError - if there is an error communicating with the xgrid.

dLife Home Page