= Tasks distribution over different computational resources = 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]). 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 {{{ public Map map(List subgrid, Script script) throws GridException { Map jobs = new HashMap(1); //get the id of the execution environment String eeID = script.getExecutionEnvironmentID(); //list of worker nodes List workerNodes = new ArrayList(); //find worker nodes for the job execution for (Iterator it = subgrid.iterator(); it.hasNext();) { GridNode node = (GridNode) it.next(); String segment = node.getAttribute(eeID); if (segment != null) { if (segment.equals("true")) { workerNodes.add(node); } } } if(workerNodes.size() == 0) { ... return null; } ... ExecuteCommandLineJob myJob = new ExecuteCommandLineJob(script); //the worker can be pick-up randomly //int i = rand.nextInt(workerNodes.size()); ... jobs.put(myJob, workerNodes.get(i)); return jobs; } }}} Back to [http://www.molgenis.org/wiki/ComputeStartExamples Examples]