eu.xtreemos.xosd.jobmng.data
Class XJob

java.lang.Object
  extended by eu.xtreemos.xosd.jobmng.data.XJob

public class XJob
extends java.lang.Object

This class manages job's status, dependencies and resources where it's present.

Author:
martag

Field Summary
private  java.util.Hashtable<CommunicationAddress,java.lang.Boolean> bufferLocations
           
private  java.util.concurrent.Semaphore cprstSem
           
private  java.util.Hashtable<java.lang.String,java.util.ArrayList<java.lang.String>> dependenciesDown
           
private  java.util.Hashtable<java.lang.String,java.util.ArrayList<java.lang.String>> dependenciesUp
           
private  int exitStatus
           
private  java.lang.String jobId
           
 java.lang.String jsdlFile
           
private  JSDLInfo jsdlInfo
           
private  java.util.Hashtable<CommunicationAddress,java.lang.String> resources
           
private  JobState state
           
private  java.lang.String user
           
private  java.lang.String vo
           
 
Constructor Summary
XJob(java.lang.String jobId, JSDLInfo subInfo, java.lang.String user)
           
 
Method Summary
 void addBufferLocation(CommunicationAddress resource)
           
 void addBufferLocation(CommunicationAddress resource, java.lang.Boolean enable)
          Adds resource to a structure that keeps track of the used resources that will need cleaning after job's death.
 void addDependenceDown(java.lang.String toJobId, java.lang.String TAG)
           
 void addDependenceUp(java.lang.String FromJobId, java.lang.String TAG)
           
 int addResource(CommunicationAddress resource)
          Add the resource to the list of resources
 void deleteDependenceDown(java.lang.String toJobId, java.lang.String TAG)
           
 void deleteDependenceUp(java.lang.String FromJobId, java.lang.String TAG)
           
 void finished(int exitStatus)
           
 java.util.Set<CommunicationAddress> getBufferLocations()
           
 java.util.ArrayList<java.lang.String> getDependencesDown(java.lang.String TAG)
           
 java.util.ArrayList<java.lang.String> getDependencesUp(java.lang.String TAG)
           
 int getExitStatus()
          This method is called from JobMng's jobWait
 java.lang.String getJobId()
           
 java.lang.String getJsdlFile()
           
 java.util.ArrayList<CommunicationAddress> getListResources()
           
 int getResourceNeededCount()
          Returns the number of exact resources needed in the JSDL
 JobState getState()
           
 java.lang.String getSubmitParam(java.lang.String paramName)
           
 java.util.ArrayList<java.lang.String> getSubmitParamList(java.lang.String paramName)
           
 java.lang.String getUser()
           
 java.lang.String getVO()
           
 void lockCheckpointRestart()
          synchronize checkpoint/restart requests
 void removeBufferLocation(CommunicationAddress resource)
           
 void removeResource(CommunicationAddress resource)
          Remove the resource from the list of resources
 boolean setRunning()
          Sets XJob state to Running.
 void setUser(java.lang.String user)
           
 void setVO(java.lang.String vo)
           
 void start(java.util.ArrayList<CommunicationAddress> resAddr)
           
 void start(CommunicationAddress resAddr)
           
 void unlockCheckpointRestart()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobId

private java.lang.String jobId

state

private JobState state

jsdlInfo

private JSDLInfo jsdlInfo

jsdlFile

public java.lang.String jsdlFile

resources

private java.util.Hashtable<CommunicationAddress,java.lang.String> resources

bufferLocations

private java.util.Hashtable<CommunicationAddress,java.lang.Boolean> bufferLocations

exitStatus

private int exitStatus

user

private java.lang.String user

vo

private java.lang.String vo

dependenciesDown

private java.util.Hashtable<java.lang.String,java.util.ArrayList<java.lang.String>> dependenciesDown

dependenciesUp

private java.util.Hashtable<java.lang.String,java.util.ArrayList<java.lang.String>> dependenciesUp

cprstSem

private java.util.concurrent.Semaphore cprstSem
Constructor Detail

XJob

public XJob(java.lang.String jobId,
            JSDLInfo subInfo,
            java.lang.String user)
Parameters:
jobId -
jsdlInfo -
Method Detail

start

public void start(java.util.ArrayList<CommunicationAddress> resAddr)

start

public void start(CommunicationAddress resAddr)

finished

public void finished(int exitStatus)

setRunning

public boolean setRunning()
Sets XJob state to Running.

Returns:
true if there was a change of state, false otherwise.

getSubmitParam

public java.lang.String getSubmitParam(java.lang.String paramName)
Returns:
the parameter from the submit info associated to the given name

getSubmitParamList

public java.util.ArrayList<java.lang.String> getSubmitParamList(java.lang.String paramName)
Returns:
the list of parameters from the submit info associated to the given name

getListResources

public java.util.ArrayList<CommunicationAddress> getListResources()
Returns:
the list of resources used by the job

addResource

public int addResource(CommunicationAddress resource)
Add the resource to the list of resources

Returns:
If the resource was already in the list return 0 if not return 1

removeResource

public void removeResource(CommunicationAddress resource)
Remove the resource from the list of resources


addBufferLocation

public void addBufferLocation(CommunicationAddress resource,
                              java.lang.Boolean enable)
Adds resource to a structure that keeps track of the used resources that will need cleaning after job's death.

Parameters:
resource -
enable - a Boolean no longer used.

removeBufferLocation

public void removeBufferLocation(CommunicationAddress resource)

getBufferLocations

public java.util.Set<CommunicationAddress> getBufferLocations()

addBufferLocation

public void addBufferLocation(CommunicationAddress resource)

getExitStatus

public int getExitStatus()
This method is called from JobMng's jobWait

Returns:
the exitStatus

getJobId

public java.lang.String getJobId()
Returns:
the jobId

getState

public JobState getState()
Returns:
the state

getUser

public java.lang.String getUser()
Returns:
the user

setUser

public void setUser(java.lang.String user)
Parameters:
user - the user to set

getVO

public java.lang.String getVO()
Returns:
a String with the identifier of the virtual organization.

setVO

public void setVO(java.lang.String vo)
Parameters:
vo - a String with the identifier of the virtual organization.

addDependenceUp

public void addDependenceUp(java.lang.String FromJobId,
                            java.lang.String TAG)

addDependenceDown

public void addDependenceDown(java.lang.String toJobId,
                              java.lang.String TAG)

deleteDependenceUp

public void deleteDependenceUp(java.lang.String FromJobId,
                               java.lang.String TAG)

deleteDependenceDown

public void deleteDependenceDown(java.lang.String toJobId,
                                 java.lang.String TAG)

getDependencesUp

public java.util.ArrayList<java.lang.String> getDependencesUp(java.lang.String TAG)

getDependencesDown

public java.util.ArrayList<java.lang.String> getDependencesDown(java.lang.String TAG)

getResourceNeededCount

public int getResourceNeededCount()
Returns the number of exact resources needed in the JSDL

Returns:
an integer value, 1 if no specified in the JSDL TODO: Check if it is Exact or exact.

lockCheckpointRestart

public void lockCheckpointRestart()
                           throws java.lang.Exception
synchronize checkpoint/restart requests

Parameters:
jobId -
Throws:
java.lang.Exception

unlockCheckpointRestart

public void unlockCheckpointRestart()
                             throws java.lang.Exception
Throws:
java.lang.Exception

getJsdlFile

public java.lang.String getJsdlFile()