Lightweight Bartering Grid

lbg.task
Class Task

java.lang.Object
  extended by lbg.task.Task
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Task>

public class Task
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable<Task>, java.io.Serializable

Author:
Cyril Briquet, Xavier Dalem
See Also:
Serialized Form

Constructor Summary
Task(java.lang.String consumer_peer_id, int job_id, int bot_id, int task_id, byte[][] jars, java.lang.String[] classnames, java.lang.String main_class, java.lang.Object[] parameters, GridData[][] datas, long nominal_runtime)
          Constructs a new Task.
 
Method Summary
 int botID()
           
 java.lang.Object clone()
           
 int compareTo(Task other)
          Note: this class has a natural ordering that is inconsistent with equals (see comment here below).
 java.lang.String consumerID()
           
 void deleteMeatada()
          Strips the Task from now-unuseful payload, such as metada, output, ...
 boolean equals(java.lang.Object obj)
           
 void flagAsCancelled(java.lang.String supplier_peer_id)
           
 void flagAsCompleted(java.lang.String supplier_peer_id, long start_time, GridData data, byte[] logs, int power)
           
 void flagAsPreempted()
           
 int getCancellationCount()
           
 GridData[] getInputDataSet()
          Returns readied data's.
 java.lang.String getInputDataSetID()
           
 long getInputDataSetSize()
           
 MetaGridData[] getInputMetaGridDataSet()
           
 int getPreemptionCount()
           
 GridData[][] getRawInputDataSet()
           
 int getSupplyingSpaceBoTID()
           
 int getSupplyingSpaceJobID()
           
 int hashCode()
           
 int id()
           
 java.lang.Object[] inputParameters()
           
 boolean isCompleted()
           
 byte[][] jars()
           
 int jobID()
           
 java.lang.Integer jobIDAsKey()
           
 java.lang.String mainClass()
           
 java.lang.String[] names()
           
 long nominalRuntime()
           
 TaskOutput output()
           
 GridData[] readyInputDataSet(GridDataManager gdm)
          Readies input data set for execution.
 void setStartTime()
           
 void setSupplyingSpaceBoTID(int tmp_bot_id)
           
 void setSupplyingSpaceJobID(int tmp_job_id)
           
 void syncWith(Task returning_self)
           
 java.lang.Integer taskIDAsKey()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Task

public Task(java.lang.String consumer_peer_id,
            int job_id,
            int bot_id,
            int task_id,
            byte[][] jars,
            java.lang.String[] classnames,
            java.lang.String main_class,
            java.lang.Object[] parameters,
            GridData[][] datas,
            long nominal_runtime)
     throws GridException
Constructs a new Task.

Throws:
GridException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(Task other)

Note: this class has a natural ordering that is inconsistent with equals (see comment here below).

It is hypothesized that 2 Tasks from different BoTs will *never* be compared. As this method is called very frequently, the implementation of compareTo() skips the comparison of BoT id, relying only on the comparison of Task id.

Specified by:
compareTo in interface java.lang.Comparable<Task>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

consumerID

public java.lang.String consumerID()

jobID

public int jobID()

jobIDAsKey

public java.lang.Integer jobIDAsKey()

botID

public int botID()

id

public int id()

taskIDAsKey

public java.lang.Integer taskIDAsKey()

jars

public byte[][] jars()

names

public java.lang.String[] names()

inputParameters

public java.lang.Object[] inputParameters()

mainClass

public java.lang.String mainClass()

nominalRuntime

public long nominalRuntime()

setSupplyingSpaceJobID

public void setSupplyingSpaceJobID(int tmp_job_id)
                            throws GridException
Throws:
GridException

getSupplyingSpaceJobID

public int getSupplyingSpaceJobID()

setSupplyingSpaceBoTID

public void setSupplyingSpaceBoTID(int tmp_bot_id)
                            throws GridException
Throws:
GridException

getSupplyingSpaceBoTID

public int getSupplyingSpaceBoTID()

getRawInputDataSet

public GridData[][] getRawInputDataSet()
                                throws GridException
Throws:
GridException

getInputMetaGridDataSet

public MetaGridData[] getInputMetaGridDataSet()
                                       throws GridException
Throws:
GridException

getInputDataSetID

public java.lang.String getInputDataSetID()

getInputDataSetSize

public long getInputDataSetSize()

readyInputDataSet

public GridData[] readyInputDataSet(GridDataManager gdm)
                             throws GridException
Readies input data set for execution. This :

Throws:
GridException - If all data's cannot be downloaded
Since:
2006-12-08

getInputDataSet

public GridData[] getInputDataSet()
                           throws GridException
Returns readied data's.

Throws:
GridException
Since:
2006-12-08
See Also:
readyInputDataSet(lbg.protocol.data.GridDataManager)

setStartTime

public void setStartTime()
                  throws GridException
Throws:
GridException

flagAsCompleted

public void flagAsCompleted(java.lang.String supplier_peer_id,
                            long start_time,
                            GridData data,
                            byte[] logs,
                            int power)
                     throws GridException
Throws:
GridException

isCompleted

public boolean isCompleted()

output

public TaskOutput output()
                  throws GridException
Throws:
GridException

flagAsCancelled

public void flagAsCancelled(java.lang.String supplier_peer_id)
                     throws GridException
Throws:
GridException

getCancellationCount

public int getCancellationCount()

flagAsPreempted

public void flagAsPreempted()

getPreemptionCount

public int getPreemptionCount()

syncWith

public void syncWith(Task returning_self)
              throws GridException
Throws:
GridException

deleteMeatada

public void deleteMeatada()
                   throws GridException
Strips the Task from now-unuseful payload, such as metada, output, ...

This is a transitional method: will become unneeded when .jar files and output data files are integrated into the data transfer architecture.

Throws:
GridException

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.