gridsim
Class Gridlet

Object
  extended bygridsim.Gridlet

public class Gridlet
extends Object

A Gridlet is a package that contains all the information related to the job and its execution management details such as job length expressed in MI (Millions Instruction), disk I/O operations, the size of input and output files, and the job originator.

These basic parameters help in determining execution time, the time required to transport input and output files between users and remote resources, and returning the processed Gridlets back to the originator along with the results.

Individual users model their application by creating Gridlets for processing them on Grid resources assigned by scheduling entities (resource brokers).

Version:
2.2, December 2003
Author:
Manzur Murshed and Rajkumar Buyya
Invariant:
$none

Field Summary
static int CANCELED
          The Gridlet has been canceled.
static int CREATED
          The Gridlet has been created and added to the GridletList object
static int FAILED
          The Gridlet is failed
static int INEXEC
          The Gridlet is in execution in a Grid node
static int PAUSED
          The Gridlet has been paused.
static int QUEUED
          The Gridlet has moved to a Grid node
static int READY
          The Gridlet has been assigned to a GridResource object as planned
static int RESUMED
          The Gridlet has been resumed from PAUSED state.
static int SUCCESS
          The Gridlet has been executed successfully
 
Constructor Summary
Gridlet(int gridletID, double gridletLength, long gridletFileSize, long gridletOutputSize)
          Allocates a new Gridlet object.
 
Method Summary
 double getActualCPUTime()
          Gets the total execution time of this Gridlet from the latest GridResource
 double GetActualCPUTime()
          Deprecated. As of GridSim 2.1, replaced by getActualCPUTime()
 double getActualCPUTime(int resId)
          Gets the total execution time of this Gridlet in a given GridResource ID
 int[] getAllResourceID()
          Gets all the GridResource IDs that executed this Gridlet
 String[] getAllResourceName()
          Gets all the GridResource names that executed this Gridlet
 double getCostPerSec()
          Gets the cost running this Gridlet in the latest GridResource
 double GetCostPerSec()
          Deprecated. As of GridSim 2.1, replaced by getCostPerSec()
 double getCostPerSec(int resId)
          Gets the cost running this Gridlet in a given GridResource ID
 double getExecStartTime()
          Gets the latest execution start time
 double getFinishTime()
          Gets the finish time of this Gridlet in a GridResource
 double GetFinishTime()
          Deprecated. As of GridSim 2.1, replaced by getFinishTime()
 long getGridletFileSize()
          Gets the input file size of this Gridlet BEFORE submitting to a GridResource
 long GetGridletFileSize()
          Deprecated. As of GridSim 2.1, replaced by getGridletFileSize()
 double getGridletFinishedSoFar()
          Gets the length of this Gridlet that has been executed so far from the latest GridResource.
 double getGridletFinishedSoFar(int resId)
          Gets the length of this Gridlet that has been executed so far in a given GridResource ID.
 String getGridletHistory()
          Gets the history of this Gridlet.
 int getGridletID()
          Gets the Gridlet ID
 int GetGridletID()
          Deprecated. As of GridSim 2.1, replaced by getGridletID()
 double getGridletLength()
          Gets the length of this Gridlet
 double GetGridletLength()
          Deprecated. As of GridSim 2.1, replaced by getGridletLength()
 long getGridletOutputSize()
          Gets the output size of this Gridlet AFTER submitting and executing to a GridResource
 long GetGridletOutputSize()
          Deprecated. As of GridSim 2.1, replaced by getGridletOutputSize()
 int getGridletStatus()
          Gets the status code of this Gridlet
 String getGridletStatusString()
          Gets the string representation of the current Gridlet status code
 double getProcessingCost()
          Gets the total cost of processing or executing this Gridlet Processing Cost = actual CPU Time * cost per sec
 double GetProcessingCost()
          Deprecated. As of GridSim 2.1, replaced by getProcessingCost()
 int getResourceID()
          Gets the latest resource ID that processes this Gridlet
 int GetResourceID()
          Deprecated. As of GridSim 2.1, replaced by getResourceID()
 String getResourceName(int resId)
          Gets the GridResource name based on its ID
 int GetStatus()
          Deprecated. As of GridSim 2.1, replaced by getGridletStatus()
 String GetStatusString()
          Deprecated. As of GridSim 2.1, replaced by getGridletStatusString()
static String getStatusString(int status)
          Gets the string representation of the given Gridlet status code
 double getSubmissionTime()
          Gets the submission or arrival time of this Gridlet from the latest GridResource
 double getSubmissionTime(int resId)
          Gets the submission or arrival time of this Gridlet in the given GridResource ID
 int getUserID()
          Gets the user or owner ID of this Gridlet
 int GetUserID()
          Deprecated. As of GridSim 2.1, replaced by getUserID()
 double getWallClockTime()
          Gets the time of this Gridlet resides in the latest GridResource (from arrival time until departure time).
 double GetWallClockTime()
          Deprecated. As of GridSim 2.1, replaced by getWallClockTime()
 double getWallClockTime(int resId)
          Gets the time of this Gridlet resides in a given GridResource ID (from arrival time until departure time).
 boolean isFinished()
          Checks whether this Gridlet has finished execution or not
 void setExecParam(double wallTime, double actualTime)
          Sets this Gridlet's execution parameters.
 void SetExecParam(double wallClockTime, double actualCPUTime)
          Deprecated. As of GridSim 2.1, replaced by setExecParam(double, double)
 void setExecStartTime(double clockTime)
          Sets the execution start time of this Gridlet inside a GridResource.
 void SetExecStartTime(double clockTime)
          Deprecated. As of GridSim 2.1, replaced by setExecStartTime(double)
 void setGridletFinishedSoFar(double length)
          Sets the length of this Gridlet that has been executed so far.
 void setGridletStatus(int newStatus)
          Sets the status code of this Gridlet
 void setResourceParameter(int resourceID, double cost)
          Sets the resource parameters for which this Gridlet is going to be executed.
 void SetResParam(int resourceID, double costPerSec)
          Deprecated. As of GridSim 2.1, replaced by setResourceParameter(int, double)
 void SetStatus(int status)
          Deprecated. As of GridSim 2.1, replaced by setGridletStatus(int)
 void setSubmissionTime(double clockTime)
          Sets the submission or arrival time of this Gridlet into a GridResource
 void SetSubmissionTime(double clockTime)
          Deprecated. As of GridSim 2.1, replaced by setSubmissionTime(double)
 void setUserID(int id)
          Sets the user or owner ID of this Gridlet.
 void SetUserID(int id)
          Deprecated. As of GridSim 2.1, replaced by setUserID(int)
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATED

public static final int CREATED
The Gridlet has been created and added to the GridletList object

See Also:
Constant Field Values

READY

public static final int READY
The Gridlet has been assigned to a GridResource object as planned

See Also:
Constant Field Values

QUEUED

public static final int QUEUED
The Gridlet has moved to a Grid node

See Also:
Constant Field Values

INEXEC

public static final int INEXEC
The Gridlet is in execution in a Grid node

See Also:
Constant Field Values

SUCCESS

public static final int SUCCESS
The Gridlet has been executed successfully

See Also:
Constant Field Values

FAILED

public static final int FAILED
The Gridlet is failed

See Also:
Constant Field Values

CANCELED

public static final int CANCELED
The Gridlet has been canceled.

See Also:
Constant Field Values

PAUSED

public static final int PAUSED
The Gridlet has been paused. It can be resumed by changing the status into RESUMED.

See Also:
Constant Field Values

RESUMED

public static final int RESUMED
The Gridlet has been resumed from PAUSED state.

See Also:
Constant Field Values
Constructor Detail

Gridlet

public Gridlet(int gridletID,
               double gridletLength,
               long gridletFileSize,
               long gridletOutputSize)
Allocates a new Gridlet object. The Gridlet length, input and output file sizes should be greater than or equal to 1.

Parameters:
gridletID - the unique ID of this Gridlet
gridletLength - the length or size of this Gridlet to be executed in a GridResource
gridletFileSize - the input file size of this Gridlet BEFORE submitting to a GridResource
gridletOutputSize - the output file size of this Gridlet AFTER submitting and executing to a GridResource
Pre Condition:
gridletID >= 0, gridletLength >= 0.0, gridletFileSize >= 1, gridletOutputSize >= 1
Post Condition:
$none
Method Detail

getGridletHistory

public String getGridletHistory()
Gets the history of this Gridlet. The layout of this history is in a readable table column with time and description as headers.

Returns:
a String containing the history of this Gridlet object.
Pre Condition:
$none
Post Condition:
$result != null

getGridletFinishedSoFar

public double getGridletFinishedSoFar()
Gets the length of this Gridlet that has been executed so far from the latest GridResource. This method is useful when trying to move this Gridlet into different GridResources or to cancel it.

Returns:
the length of a partially executed Gridlet or the full Gridlet length if it is completed
Pre Condition:
$none
Post Condition:
$result >= 0.0

isFinished

public boolean isFinished()
Checks whether this Gridlet has finished execution or not

Returns:
true if this Gridlet has finished execution, false otherwise
Pre Condition:
$none
Post Condition:
$none

setGridletFinishedSoFar

public void setGridletFinishedSoFar(double length)
Sets the length of this Gridlet that has been executed so far. This method is used by ResGridlet class when an application is decided to cancel or to move this Gridlet into different GridResources.

Parameters:
length - length of this Gridlet
See Also:
AllocPolicy, ResGridlet
Pre Condition:
length >= 0.0
Post Condition:
$none

GetGridletID

public int GetGridletID()
Deprecated. As of GridSim 2.1, replaced by getGridletID()

Gets the Gridlet ID

Returns:
the Gridlet ID
Pre Condition:
$none
Post Condition:
$result >= 0

getGridletID

public int getGridletID()
Gets the Gridlet ID

Returns:
the Gridlet ID
Pre Condition:
$none
Post Condition:
$result >= 0

SetUserID

public void SetUserID(int id)
Deprecated. As of GridSim 2.1, replaced by setUserID(int)

Sets the user or owner ID of this Gridlet. It is VERY important to set the user ID, otherwise this Gridlet will not be executed in a GridResource.

Parameters:
id - the user ID
Pre Condition:
id >= 0
Post Condition:
$none

setUserID

public void setUserID(int id)
Sets the user or owner ID of this Gridlet. It is VERY important to set the user ID, otherwise this Gridlet will not be executed in a GridResource.

Parameters:
id - the user ID
Pre Condition:
id >= 0
Post Condition:
$none

GetUserID

public int GetUserID()
Deprecated. As of GridSim 2.1, replaced by getUserID()

Gets the user or owner ID of this Gridlet

Returns:
the user ID or -1 if the user ID has not been set before
Pre Condition:
$none
Post Condition:
$result >= -1

getUserID

public int getUserID()
Gets the user or owner ID of this Gridlet

Returns:
the user ID or -1 if the user ID has not been set before
Pre Condition:
$none
Post Condition:
$result >= -1

GetResourceID

public int GetResourceID()
Deprecated. As of GridSim 2.1, replaced by getResourceID()

Gets the latest resource ID that processes this Gridlet

Returns:
the resource ID or -1 if none
Pre Condition:
$none
Post Condition:
$result >= -1

getResourceID

public int getResourceID()
Gets the latest resource ID that processes this Gridlet

Returns:
the resource ID or -1 if none
Pre Condition:
$none
Post Condition:
$result >= -1

GetGridletFileSize

public long GetGridletFileSize()
Deprecated. As of GridSim 2.1, replaced by getGridletFileSize()

Gets the input file size of this Gridlet BEFORE submitting to a GridResource

Returns:
the input file size of this Gridlet
Pre Condition:
$none
Post Condition:
$result >= 1

getGridletFileSize

public long getGridletFileSize()
Gets the input file size of this Gridlet BEFORE submitting to a GridResource

Returns:
the input file size of this Gridlet
Pre Condition:
$none
Post Condition:
$result >= 1

GetGridletOutputSize

public long GetGridletOutputSize()
Deprecated. As of GridSim 2.1, replaced by getGridletOutputSize()

Gets the output size of this Gridlet AFTER submitting and executing to a GridResource

Returns:
the Gridlet output file size
Pre Condition:
$none
Post Condition:
$result >= 1

getGridletOutputSize

public long getGridletOutputSize()
Gets the output size of this Gridlet AFTER submitting and executing to a GridResource

Returns:
the Gridlet output file size
Pre Condition:
$none
Post Condition:
$result >= 1

SetResParam

public void SetResParam(int resourceID,
                        double costPerSec)
Deprecated. As of GridSim 2.1, replaced by setResourceParameter(int, double)

Sets the resource parameters for which this Gridlet is going to be executed.

Parameters:
resourceID - the GridResource ID
costPerSec - the cost running this GridResource per second
Pre Condition:
resourceID >= 0, costPerSec > 0.0
Post Condition:
$none

setResourceParameter

public void setResourceParameter(int resourceID,
                                 double cost)
Sets the resource parameters for which this Gridlet is going to be executed.

Parameters:
resourceID - the GridResource ID
cost - the cost running this GridResource per second
Pre Condition:
resourceID >= 0, cost > 0.0
Post Condition:
$none

SetSubmissionTime

public void SetSubmissionTime(double clockTime)
Deprecated. As of GridSim 2.1, replaced by setSubmissionTime(double)

Sets the submission or arrival time of this Gridlet into a GridResource

Parameters:
clockTime - the submission time
Pre Condition:
clockTime >= 0.0
Post Condition:
$none

setSubmissionTime

public void setSubmissionTime(double clockTime)
Sets the submission or arrival time of this Gridlet into a GridResource

Parameters:
clockTime - the submission time
Pre Condition:
clockTime >= 0.0
Post Condition:
$none

getSubmissionTime

public double getSubmissionTime()
Gets the submission or arrival time of this Gridlet from the latest GridResource

Returns:
the submission time or 0.0 if none
Pre Condition:
$none
Post Condition:
$result >= 0.0

SetExecStartTime

public void SetExecStartTime(double clockTime)
Deprecated. As of GridSim 2.1, replaced by setExecStartTime(double)

Sets the execution start time of this Gridlet inside a GridResource. NOTE: With new functionalities, such as being able to cancel / to pause / to resume this Gridlet, the execution start time only holds the latest one. Meaning, all previous execution start time are ignored.

Parameters:
clockTime - the latest execution start time
Pre Condition:
clockTime >= 0.0
Post Condition:
$none

setExecStartTime

public void setExecStartTime(double clockTime)
Sets the execution start time of this Gridlet inside a GridResource. NOTE: With new functionalities, such as being able to cancel / to pause / to resume this Gridlet, the execution start time only holds the latest one. Meaning, all previous execution start time are ignored.

Parameters:
clockTime - the latest execution start time
Pre Condition:
clockTime >= 0.0
Post Condition:
$none

getExecStartTime

public double getExecStartTime()
Gets the latest execution start time

Returns:
the latest execution start time
Pre Condition:
$none
Post Condition:
$result >= 0.0

SetExecParam

public void SetExecParam(double wallClockTime,
                         double actualCPUTime)
Deprecated. As of GridSim 2.1, replaced by setExecParam(double, double)

Sets this Gridlet's execution parameters. These parameters are set by the GridResource before departure or sending back to the original Gridlet's owner.

Parameters:
wallClockTime - the time of this Gridlet resides in a GridResource (from arrival time until departure time).
actualCPUTime - the total execution time of this Gridlet in a GridResource.
Pre Condition:
wallClockTime >= 0.0, actualCPUTime >= 0.0
Post Condition:
$none

setExecParam

public void setExecParam(double wallTime,
                         double actualTime)
Sets this Gridlet's execution parameters. These parameters are set by the GridResource before departure or sending back to the original Gridlet's owner.

Parameters:
wallTime - the time of this Gridlet resides in a GridResource (from arrival time until departure time).
actualTime - the total execution time of this Gridlet in a GridResource.
Pre Condition:
wallTime >= 0.0, actualTime >= 0.0
Post Condition:
$none

SetStatus

public void SetStatus(int status)
               throws Exception
Deprecated. As of GridSim 2.1, replaced by setGridletStatus(int)

Sets the status code of this Gridlet

Parameters:
status - the status code of this Gridlet
Throws:
Exception - Invalid Gridlet status
Pre Condition:
status >= 0 && status <= 5
Post Condition:
$none

setGridletStatus

public void setGridletStatus(int newStatus)
                      throws Exception
Sets the status code of this Gridlet

Parameters:
newStatus - the status code of this Gridlet
Throws:
Exception - Invalid range of Gridlet status
Pre Condition:
newStatus >= 0 && newStatus <= 8
Post Condition:
$none

GetStatus

public int GetStatus()
Deprecated. As of GridSim 2.1, replaced by getGridletStatus()

Gets the status code of this Gridlet

Returns:
the status code of this Gridlet
Pre Condition:
$none
Post Condition:
$result >= 0

getGridletStatus

public int getGridletStatus()
Gets the status code of this Gridlet

Returns:
the status code of this Gridlet
Pre Condition:
$none
Post Condition:
$result >= 0

GetStatusString

public String GetStatusString()
Deprecated. As of GridSim 2.1, replaced by getGridletStatusString()

Gets the string representation of the current Gridlet status code

Returns:
the Gridlet status code as a string or null if the status code is unknown
Pre Condition:
$none
Post Condition:
$none

getGridletStatusString

public String getGridletStatusString()
Gets the string representation of the current Gridlet status code

Returns:
the Gridlet status code as a string or null if the status code is unknown
Pre Condition:
$none
Post Condition:
$none

getStatusString

public static String getStatusString(int status)
Gets the string representation of the given Gridlet status code

Parameters:
status - the Gridlet status code
Returns:
the Gridlet status code as a string or null if the status code is unknown
Pre Condition:
$none
Post Condition:
$none

GetGridletLength

public double GetGridletLength()
Deprecated. As of GridSim 2.1, replaced by getGridletLength()

Gets the length of this Gridlet

Returns:
the length of this Gridlet
Pre Condition:
$none
Post Condition:
$result >= 0.0

getGridletLength

public double getGridletLength()
Gets the length of this Gridlet

Returns:
the length of this Gridlet
Pre Condition:
$none
Post Condition:
$result >= 0.0

GetActualCPUTime

public double GetActualCPUTime()
Deprecated. As of GridSim 2.1, replaced by getActualCPUTime()

Gets the total execution time of this Gridlet from the latest GridResource

Returns:
the the total execution time of this Gridlet in a GridResource
Pre Condition:
$none
Post Condition:
$result >= 0.0

getActualCPUTime

public double getActualCPUTime()
Gets the total execution time of this Gridlet from the latest GridResource

Returns:
the total execution time of this Gridlet in a GridResource
Pre Condition:
$none
Post Condition:
$result >= 0.0

GetCostPerSec

public double GetCostPerSec()
Deprecated. As of GridSim 2.1, replaced by getCostPerSec()

Gets the cost running this Gridlet in the latest GridResource

Returns:
the cost associated with running this Gridlet or 0.0 if none
Pre Condition:
$none
Post Condition:
$result >= 0.0

getCostPerSec

public double getCostPerSec()
Gets the cost running this Gridlet in the latest GridResource

Returns:
the cost associated with running this Gridlet or 0.0 if none
Pre Condition:
$none
Post Condition:
$result >= 0.0

GetProcessingCost

public double GetProcessingCost()
Deprecated. As of GridSim 2.1, replaced by getProcessingCost()

Gets the total cost of processing or executing this Gridlet. Processing Cost = actual CPU Time * cost per sec

Returns:
the total cost of processing Gridlet
See Also:
getActualCPUTime(), getCostPerSec()
Pre Condition:
$none
Post Condition:
$result >= 0.0

getProcessingCost

public double getProcessingCost()
Gets the total cost of processing or executing this Gridlet Processing Cost = actual CPU Time * cost per sec

Returns:
the total cost of processing Gridlet
See Also:
getActualCPUTime(), getCostPerSec()
Pre Condition:
$none
Post Condition:
$result >= 0.0

GetWallClockTime

public double GetWallClockTime()
Deprecated. As of GridSim 2.1, replaced by getWallClockTime()

Gets the time of this Gridlet resides in the latest GridResource (from arrival time until departure time).

Returns:
the time of this Gridlet resides in a GridResource
Pre Condition:
$none
Post Condition:
$result >= 0.0

getWallClockTime

public double getWallClockTime()
Gets the time of this Gridlet resides in the latest GridResource (from arrival time until departure time).

Returns:
the time of this Gridlet resides in a GridResource
Pre Condition:
$none
Post Condition:
$result >= 0.0

getAllResourceName

public String[] getAllResourceName()
Gets all the GridResource names that executed this Gridlet

Returns:
an array of GridResource names or null if it has none
Pre Condition:
$none
Post Condition:
$none

getAllResourceID

public int[] getAllResourceID()
Gets all the GridResource IDs that executed this Gridlet

Returns:
an array of GridResource IDs or null if it has none
Pre Condition:
$none
Post Condition:
$none

getActualCPUTime

public double getActualCPUTime(int resId)
Gets the total execution time of this Gridlet in a given GridResource ID

Parameters:
resId - a GridResource entity ID
Returns:
the total execution time of this Gridlet in a GridResource or 0.0 if not found
Pre Condition:
resId >= 0
Post Condition:
$result >= 0.0

getCostPerSec

public double getCostPerSec(int resId)
Gets the cost running this Gridlet in a given GridResource ID

Parameters:
resId - a GridResource entity ID
Returns:
the cost associated with running this Gridlet or 0.0 if not found
Pre Condition:
resId >= 0
Post Condition:
$result >= 0.0

getGridletFinishedSoFar

public double getGridletFinishedSoFar(int resId)
Gets the length of this Gridlet that has been executed so far in a given GridResource ID. This method is useful when trying to move this Gridlet into different GridResources or to cancel it.

Parameters:
resId - a GridResource entity ID
Returns:
the length of a partially executed Gridlet or the full Gridlet length if it is completed or 0.0 if not found
Pre Condition:
resId >= 0
Post Condition:
$result >= 0.0

getSubmissionTime

public double getSubmissionTime(int resId)
Gets the submission or arrival time of this Gridlet in the given GridResource ID

Parameters:
resId - a GridResource entity ID
Returns:
the submission time or 0.0 if not found
Pre Condition:
resId >= 0
Post Condition:
$result >= 0.0

getWallClockTime

public double getWallClockTime(int resId)
Gets the time of this Gridlet resides in a given GridResource ID (from arrival time until departure time).

Parameters:
resId - a GridResource entity ID
Returns:
the time of this Gridlet resides in the GridResource or 0.0 if not found
Pre Condition:
resId >= 0
Post Condition:
$result >= 0.0

getResourceName

public String getResourceName(int resId)
Gets the GridResource name based on its ID

Parameters:
resId - a GridResource entity ID
Returns:
the GridResource name or null if not found
Pre Condition:
resId >= 0
Post Condition:
$none

GetFinishTime

public double GetFinishTime()
Deprecated. As of GridSim 2.1, replaced by getFinishTime()

Gets the finish time of this Gridlet in a GridResource

Returns:
the finish or completion time of this Gridlet or -1 if not finished yet.
Pre Condition:
$none
Post Condition:
$result >= -1

getFinishTime

public double getFinishTime()
Gets the finish time of this Gridlet in a GridResource

Returns:
the finish or completion time of this Gridlet or -1 if not finished yet.
Pre Condition:
$none
Post Condition:
$result >= -1