Lightweight Bartering Grid

lbg.peer.register.learning.consumption
Class JobConsumptionOutcomeTracker

java.lang.Object
  extended by lbg.peer.register.learning.consumption.JobConsumptionOutcomeTracker

public class JobConsumptionOutcomeTracker
extends java.lang.Object

A JobConsumptionOutcomeTracker tracks completion/cancellation of the Job's Tasks by the involved Supplier Peers, providing a useful reliability metric that may be used to black-list unreliable Suppliers.

Author:
Cyril Briquet

Field Summary
static float MAX_CONSUMPTION_FAILURES_FACTOR
          Number of allowed Task execution failures for the Tasks of the Job before its Tasks are restricted to execution as Local Tasks only, expressed as a factor of the number of Tasks of the Job.
static float MAX_SUPPLIER_FAILURES_FACTOR
          Number of allowed Task execution failures for the Tasks of the Job before supplier Peer is black-listed (for the current Job), expressed as a factor of the number of Tasks of the Job.
 
Constructor Summary
JobConsumptionOutcomeTracker(java.lang.String owner_peer_id, int job_id, int total_job_tasks)
           
 
Method Summary
 double estimateConsumptionTaskRuntime()
           
 int getCompletedConsumptionTasksCount()
           
static void main(java.lang.String[] args)
          For testing purposes only.
 java.util.ArrayList<java.lang.String> rankPeers()
          Return reliability ranking of Supplier Peers (i.e.
 boolean shouldBlackListPeer(java.lang.String supplier_id)
          Indicates whether the target supplier should be blacklisted, i.e.
 boolean shouldBlackListPeer(SupplierReliabilityHistory b)
          Indicates whether a supplier with target reliability behavior should be blacklisted, i.e.
 boolean shouldRestrictJobToLocalExecution()
          Indicates whether the Tasks of the tracked Job can be executed as Consumption Tasks, or if it is preferable not to, because it comes that these are extremely difficult to execute by Supplier Peers (either intrinsically, or because the environment is totally unreliable).
 java.util.Iterator<java.lang.String> suppliers()
          Return the set of Peers that have supplied Resources for Consumption Tasks of the Job tracked by this tracker.
 java.lang.String toString()
           
 void trackCancelledTask(java.lang.String supplier_peer, long runtime)
           
 void trackCompletedTask(java.lang.String supplier_peer, long runtime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_CONSUMPTION_FAILURES_FACTOR

public static final float MAX_CONSUMPTION_FAILURES_FACTOR
Number of allowed Task execution failures for the Tasks of the Job before its Tasks are restricted to execution as Local Tasks only, expressed as a factor of the number of Tasks of the Job.

See Also:
Constant Field Values

MAX_SUPPLIER_FAILURES_FACTOR

public static final float MAX_SUPPLIER_FAILURES_FACTOR
Number of allowed Task execution failures for the Tasks of the Job before supplier Peer is black-listed (for the current Job), expressed as a factor of the number of Tasks of the Job.

See Also:
Constant Field Values
Constructor Detail

JobConsumptionOutcomeTracker

public JobConsumptionOutcomeTracker(java.lang.String owner_peer_id,
                                    int job_id,
                                    int total_job_tasks)
                             throws GridException
Throws:
GridException
Method Detail

toString

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

trackCompletedTask

public void trackCompletedTask(java.lang.String supplier_peer,
                               long runtime)
                        throws GridException
Throws:
GridException

trackCancelledTask

public void trackCancelledTask(java.lang.String supplier_peer,
                               long runtime)
                        throws GridException
Throws:
GridException

estimateConsumptionTaskRuntime

public double estimateConsumptionTaskRuntime()

getCompletedConsumptionTasksCount

public int getCompletedConsumptionTasksCount()

shouldRestrictJobToLocalExecution

public boolean shouldRestrictJobToLocalExecution()
                                          throws GridException
Indicates whether the Tasks of the tracked Job can be executed as Consumption Tasks, or if it is preferable not to, because it comes that these are extremely difficult to execute by Supplier Peers (either intrinsically, or because the environment is totally unreliable).

Throws:
GridException

shouldBlackListPeer

public boolean shouldBlackListPeer(SupplierReliabilityHistory b)
                            throws GridException
Indicates whether a supplier with target reliability behavior should be blacklisted, i.e. if it has been very unreliable when running Consumption Tasks of the tracked BoT.

Throws:
GridException

shouldBlackListPeer

public boolean shouldBlackListPeer(java.lang.String supplier_id)
                            throws GridException
Indicates whether the target supplier should be blacklisted, i.e. if it has been very unreliable when running Consumption Tasks of the tracked BoT.

Throws:
GridException

rankPeers

public java.util.ArrayList<java.lang.String> rankPeers()
                                                throws GridException
Return reliability ranking of Supplier Peers (i.e. Peers that have accepted the submission of at least 1 Task from the target Job), sorted by decreasing reliability, as defined by their SupplierReliabilityHistory.

The most unreliable Peers are excluded from the ranking.

Returns:
reliability ranking of Suppliers, ordered by decreasing reliability
Throws:
GridException - if an error occurs while ranking Suppliers

suppliers

public java.util.Iterator<java.lang.String> suppliers()
Return the set of Peers that have supplied Resources for Consumption Tasks of the Job tracked by this tracker.

Returns:
Suppliers set

main

public static void main(java.lang.String[] args)
For testing purposes only.


Lightweight Bartering Grid

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