Created
September 4, 2008 01:28
-
-
Save tomjadams/8700 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.googlecode.furnace.grid | |
import org.gridgain.grid.{GridTaskSplitAdapter, GridJobResult, GridJob} | |
import analyse.{AnalysisResult, SequenceIdentifier} | |
import java.util.{List => JavaList} | |
import java.util.{Collection => JavaCollection} | |
import sequence.GeneSequence | |
final class GeneSequenceGridTask extends GridTaskSplitAdapter[Iterator[GeneSequence], List[AnalysisResult]] { | |
def split(gridSize: Int, inputSequences: Iterator[GeneSequence]): JavaCollection[_ <: GridJob] = error("I'm not really a list") | |
def reduce(results: JavaList[GridJobResult]): List[AnalysisResult] = error("I'm not really a list") | |
} | |
object Gridity { | |
import GridBootstrapper._ | |
import org.gridgain.grid.GridTaskFuture | |
import scalaz.list.NonEmptyList, NonEmptyList._ | |
import sequence.GeneSequence._ | |
import sequence.Base | |
def main(args: Array[String]) { | |
startMasterNode | |
try { | |
val future: GridTaskFuture[List[AnalysisResult]] = masterNode.execute(classOf[GeneSequenceGridTask], sequences("ACGT")); | |
val results: List[AnalysisResult] = future.get(); | |
} finally { | |
stopMasterNode | |
} | |
} | |
private def sequences(sequence: String) = List(geneSequence(baseSeq(sequence))).elements | |
private def baseSeq(bases: String): NonEmptyList[Base] = list(bases.map(_.toByte: Base).toList) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment