本文整理汇总了Java中nl.vu.cs.ajira.submissions.Job.setActions方法的典型用法代码示例。如果您正苦于以下问题:Java Job.setActions方法的具体用法?Java Job.setActions怎么用?Java Job.setActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nl.vu.cs.ajira.submissions.Job
的用法示例。
在下文中一共展示了Job.setActions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static void main(String args[]) {
Ajira ajira = new Ajira();
ajira.getConfiguration().set(InputLayer.INPUT_LAYER_CLASS, RandomInputLayer.class.getName());
try {
ajira.startup();
} catch (Exception e1) {
e1.printStackTrace();
}
Job job = new Job();
try {
job.setActions(generateSequence());
} catch (Exception e) {
e.printStackTrace();
}
double startTime = System.nanoTime();
ajira.waitForCompletion(job);
double endTime = System.nanoTime();
System.out.println("Total time: " + (endTime - startTime) / 1000000.0 + " ms");
ajira.shutdown();
}
示例2: launchReasoning
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
private static void launchReasoning(Ajira arch) throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
if (deltaDir == null) {
ActionsHelper.readFakeTuple(actions);
CompleteRulesController.addToChain(actions);
} else {
loadLastStepFromFile();
ActionsHelper.readFakeTuple(actions);
IncrRulesController.addToChain(actions, deltaDir, add);
}
job.setActions(actions);
if (arch.amItheServer()) {
try {
Submission s = arch.waitForCompletion(job);
s.printStatistics();
} catch (Exception e) {
log.error("The job is failed!", e);
}
}
writeLastStepToFile();
}
示例3: launchLister
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
private static void launchLister(Ajira arch, String dest) throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionsHelper.readEverythingFromBTree(actions);
ActionConf c = ActionFactory.getActionConf(WriteToFiles.class);
c.setParamString(WriteToFiles.S_PATH, dest);
actions.add(c);
job.setActions(actions);
if (arch.amItheServer()) {
try {
Submission s = arch.waitForCompletion(job);
s.printStatistics();
} catch (Exception e) {
log.error("The job is failed!", e);
}
}
}
示例4: launchProcessing
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
private static void launchProcessing(Ajira ajira)
throws ActionNotConfiguredException {
ActionSequence actions = new ActionSequence();
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, dictionaryDir);
c.setParamString(ReadFromFiles.S_FILE_FILTER,
FilterOnlyDictionaryFiles.class.getName());
c.setParamString(ReadFromFiles.S_CUSTOM_READER,
Dictionary.Reader.class.getName());
actions.add(c);
DictionaryLookup.addToChain(input, output, actions);
Job job = new Job();
job.setActions(actions);
Submission s = ajira.waitForCompletion(job);
s.printStatistics();
ajira.shutdown();
}
示例5: createJob
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static Job createJob(String inDir, String outDir)
throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
// Read the input files
ActionConf action = ActionFactory.getActionConf(ReadFromFiles.class);
action.setParamString(ReadFromFiles.S_PATH, inDir);
actions.add(action);
// Count the words
actions.add(ActionFactory.getActionConf(CountWords.class));
// Groups the pairs
action = ActionFactory.getActionConf(GroupBy.class);
action.setParamStringArray(GroupBy.SA_TUPLE_FIELDS,
TString.class.getName(), TInt.class.getName());
action.setParamByteArray(GroupBy.BA_FIELDS_TO_GROUP, (byte) 0);
actions.add(action);
// Sum the counts
actions.add(ActionFactory.getActionConf(SumCounts.class));
// Write the results on files
action = ActionFactory.getActionConf(WriteToFiles.class);
action.setParamString(WriteToFiles.S_PATH, outDir);
actions.add(action);
job.setActions(actions);
return job;
}
示例6: createJob
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static Job createJob(String filename)
throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
// Input
RandomTupleGeneratorAction.addToChain(numTuples, numDistinctPhrases,
numWordsPerPhrase, numDistinctWords, seed, actions);
// Count the words
actions.add(ActionFactory.getActionConf(CountWords.class));
ActionConf action = ActionFactory.getActionConf(PartitionToNodes.class);
action.setParamInt(PartitionToNodes.I_NPARTITIONS_PER_NODE,
numPartitions);
action.setParamBoolean(PartitionToNodes.B_SORT, false);
action.setParamBoolean(PartitionToNodes.B_STREAMING, true);
byte[] bytes = { 0 };
action.setParamByteArray(PartitionToNodes.BA_PARTITION_FIELDS, bytes);
action.setParamStringArray(PartitionToNodes.SA_TUPLE_FIELDS,
TString.class.getName());
actions.add(action);
// Sum the counts
actions.add(ActionFactory.getActionConf(SumCounts.class));
// Collect to node
action = ActionFactory.getActionConf(CollectToNode.class);
action.setParamBoolean(CollectToNode.B_SORT, false);
action.setParamBoolean(CollectToNode.B_STREAMING_MODE, true);
action.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
TString.class.getName(), TLong.class.getName());
actions.add(action);
// Print the results
TuplePrinter.addToChain(filename, actions);
job.setActions(actions);
return job;
}
示例7: generateFilterMultiThreadExample
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
private final Job generateFilterMultiThreadExample(int numThreads, int numActions) {
Job job = new Job();
ActionSequence seq = new ActionSequence();
try {
MultiThreadingController.addToChain(numThreads, numActions, seq);
} catch (ActionNotConfiguredException e) {
e.printStackTrace();
}
job.setActions(seq);
return job;
}
示例8: createCollectToNodeJob
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static Job createCollectToNodeJob(String inDir, String outDir)
throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, inDir);
actions.add(c);
// A
actions.add(ActionFactory.getActionConf(A.class));
c = ActionFactory.getActionConf(CollectToNode.class);
c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
TString.class.getName());
actions.add(c);
// C
actions.add(ActionFactory.getActionConf(C.class));
// Write the results on files
c = ActionFactory.getActionConf(WriteToFiles.class);
c.setParamString(WriteToFiles.S_PATH, outDir);
actions.add(c);
job.setActions(actions);
return job;
}
示例9: createSimpleJob
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static Job createSimpleJob(String inDir, String outDir)
throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, inDir);
actions.add(c);
// A
actions.add(ActionFactory.getActionConf(A.class));
// Partition
c = ActionFactory.getActionConf(PartitionToNodes.class);
c.setParamStringArray(PartitionToNodes.SA_TUPLE_FIELDS,
TString.class.getName());
c.setParamInt(PartitionToNodes.I_NPARTITIONS_PER_NODE, 2);
actions.add(c);
// C
actions.add(ActionFactory.getActionConf(C.class));
// Write the results on files
c = ActionFactory.getActionConf(WriteToFiles.class);
c.setParamString(WriteToFiles.S_PATH, outDir);
actions.add(c);
job.setActions(actions);
return job;
}
示例10: createDoublePartitioningJob
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static Job createDoublePartitioningJob(String inDir, String outDir)
throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, inDir);
actions.add(c);
// A
actions.add(ActionFactory.getActionConf(A.class));
// Partition
c = ActionFactory.getActionConf(PartitionToNodes.class);
c.setParamStringArray(PartitionToNodes.SA_TUPLE_FIELDS,
TString.class.getName());
c.setParamInt(PartitionToNodes.I_NPARTITIONS_PER_NODE, 10);
actions.add(c);
// C
actions.add(ActionFactory.getActionConf(C.class));
// Partition
c = ActionFactory.getActionConf(PartitionToNodes.class);
c.setParamStringArray(PartitionToNodes.SA_TUPLE_FIELDS,
TString.class.getName());
c.setParamInt(PartitionToNodes.I_NPARTITIONS_PER_NODE, 1);
actions.add(c);
// D
actions.add(ActionFactory.getActionConf(D.class));
// Write the results on files
c = ActionFactory.getActionConf(WriteToFiles.class);
c.setParamString(WriteToFiles.S_PATH, outDir);
actions.add(c);
job.setActions(actions);
return job;
}
示例11: createJob
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static Job createJob(String inDir, String outDir)
throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, inDir);
actions.add(c);
// A
actions.add(ActionFactory.getActionConf(A.class));
// Partition
c = ActionFactory.getActionConf(PartitionToNodes.class);
c.setParamStringArray(PartitionToNodes.SA_TUPLE_FIELDS,
TString.class.getName());
c.setParamInt(PartitionToNodes.I_NPARTITIONS_PER_NODE, 1);
actions.add(c);
// C
actions.add(ActionFactory.getActionConf(C.class));
// Write the results on files
c = ActionFactory.getActionConf(WriteToFiles.class);
c.setParamString(WriteToFiles.S_PATH, outDir);
actions.add(c);
job.setActions(actions);
return job;
}
示例12: printDerivations
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
private static void printDerivations(Ajira arch) throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionsHelper.readFakeTuple(actions);
Debugging.addToChain(actions);
job.setActions(actions);
if (arch.amItheServer()) {
try {
arch.waitForCompletion(job);
} catch (Exception e) {
log.error("The job is failed!", e);
}
}
}
示例13: printDerivationsOnFile
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
private static void printDerivationsOnFile(Ajira arch) throws ActionNotConfiguredException {
Job job = new Job();
ActionSequence actions = new ActionSequence();
ActionsHelper.readFakeTuple(actions);
Debugging.addToChain(actions, debugFile);
job.setActions(actions);
if (arch.amItheServer()) {
try {
arch.waitForCompletion(job);
} catch (Exception e) {
log.error("The job is failed!", e);
}
}
}
示例14: main
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("USAGE: PrintDictionary <dir>");
return;
}
ActionSequence list = new ActionSequence();
File dictDir = new File(args[0]);
if (dictDir.exists() && dictDir.listFiles().length > 0) {
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, dictDir.getAbsolutePath());
c.setParamString(ReadFromFiles.S_FILE_FILTER,
FilterOnlyDictionaryFiles.class.getName());
c.setParamString(ReadFromFiles.S_CUSTOM_READER,
Dictionary.Reader.class.getName());
list.add(c);
list.add(ActionFactory.getActionConf(PrintDictionary.class));
Ajira ajira = new Ajira();
ajira.startup();
if (ajira.amItheServer()) {
// Init the program and launch the execution.
Job job = new Job();
job.setActions(list);
ajira.waitForCompletion(job);
ajira.shutdown();
}
} else {
System.err.println("Dictionary directory does not contain dictionary.");
return;
}
}
示例15: main
import nl.vu.cs.ajira.submissions.Job; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.out
.println("Usage: BenchmarkSorting <input dir> <output dir> --output [btree,files,none] --ibis-server --procs <num>");
System.exit(0);
}
parseArgs(args);
// Launch a simple job
Ajira arch = new Ajira();
Configuration conf = arch.getConfiguration();
// Init some configuration params of the cluster
conf.setBoolean(Consts.START_IBIS, ibis);
conf.setInt(Consts.N_PROC_THREADS, nProcThreads);
// conf.setInt(ReadFromFiles.MINIMUM_SPLIT_SIZE, 30000);
// Start the cluster
arch.startup();
if (arch.amItheServer()) {
// Now we can launch our program
Job job = new Job();
// Set up the program
ActionSequence actions = new ActionSequence();
// Split the input in more chunks, so that the reading
// is done in parallel
ActionConf c = ActionFactory.getActionConf(ReadFromFiles.class);
c.setParamString(ReadFromFiles.S_PATH, args[0]);
actions.add(c);
// Distribute all the lines
c = ActionFactory.getActionConf(PartitionToNodes.class);
c.setParamStringArray(PartitionToNodes.SA_TUPLE_FIELDS,
TString.class.getName());
c.setParamBoolean(PartitionToNodes.B_SORT, true);
int nNodes = arch.getNumberNodes();
int nPartitionsPerNode = nNodes > 32 ? 1 : 32 / nNodes; // Assumes
// nNodes is
// a power
// of 2.
c.setParamInt(PartitionToNodes.I_NPARTITIONS_PER_NODE,
nPartitionsPerNode);
actions.add(c);
// Remove the duplicates
actions.add(ActionFactory.getActionConf(RemoveDuplicates.class));
if (output.equals("files")) {
c = ActionFactory.getActionConf(WriteToFiles.class);
c.setParamString(WriteToFiles.S_PATH, args[1]);
actions.add(c);
} else if (output.equals("btree")) {
// TODO: Implement
} else if (output.equals("none")) {
c = ActionFactory.getActionConf(CollectToNode.class);
c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
TString.class.getName());
actions.add(c);
}
// Launch it!
job.setActions(actions);
Submission s = arch.waitForCompletion(job);
s.printStatistics();
// Exit
arch.shutdown();
System.exit(0);
}
}