Changes between Version 2 and Version 3 of ComputeStartExample4


Ignore:
Timestamp:
2010-11-12T10:31:01+01:00 (14 years ago)
Author:
george
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ComputeStartExample4

    v2 v3  
    11= Tasks distribution over different computational resources = 
    22
    3 Tasks distribution is implemented using [http://www.gridgain.com/javadoc/org/gridgain/grid/GridTaskAdapter.html GridGain GridTaskAdapter]. In this scenario, a cloud should have several segments. Workers in the cloud can belong to one or more segments (Worker [http://www.molgenis.org/wiki/ComputeStartExample8 settings example]).
     3Tasks distribution is implemented using [http://www.gridgain.com/javadoc/org/gridgain/grid/GridTaskAdapter.html GridGain GridTaskAdapter]. In this scenario, a cloud should have several segments. Workers in the cloud can belong to one or more segments (Worker [http://www.molgenis.org/wiki/ComputeStartExample8 settings example]). Every script should contain information about execution environment or cloud segment, where it should be executed. First, We found all Worker nodes from this segment. Then, a script is sent to one of them 
     4
     5{{{
     6public Map<? extends GridJob, GridNode> map(List<GridNode> subgrid, Script script) throws GridException
     7{
     8       
     9        Map<ExecuteCommandLineJob, GridNode> jobs = new HashMap<ExecuteCommandLineJob, GridNode>(1);
     10
     11    //get the id of the execution environment
     12    String eeID = script.getExecutionEnvironmentID();
     13
     14    //list of worker nodes
     15    List<GridNode> workerNodes = new ArrayList<GridNode>();
     16
     17    //find worker nodes for the job execution
     18    for (Iterator it = subgrid.iterator(); it.hasNext();)
     19    {
     20       GridNode node = (GridNode) it.next();
     21       String segment = node.getAttribute(eeID);
     22
     23       if (segment != null)
     24       {
     25          if (segment.equals("true"))
     26          {
     27             workerNodes.add(node);
     28          }
     29       }
     30    }
     31 
     32    if(workerNodes.size() == 0)
     33    {
     34        ...
     35        return null;
     36    }
     37
     38    ...
     39    ExecuteCommandLineJob myJob = new ExecuteCommandLineJob(script);
     40
     41    //the worker can be pick-up randomly
     42    //int i = rand.nextInt(workerNodes.size());
     43
     44    ...
     45    jobs.put(myJob, workerNodes.get(i));
     46    return jobs;
     47}
     48
     49}}}
     50
    451
    552Back to [http://www.molgenis.org/wiki/ComputeStartExamples Examples]