当前位置: 首页>>代码示例>>Java>>正文


Java Job.setActions方法代码示例

本文整理汇总了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();
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:21,代码来源:CollectToNodeTest.java

示例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();
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:24,代码来源:Reasoner.java

示例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);
		}
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:19,代码来源:ListDB.java

示例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();
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:19,代码来源:RetrieveDictionaryEncoding.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:32,代码来源:WordCount.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:41,代码来源:StreamingWordCount.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:12,代码来源:AjiraEval.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:29,代码来源:TestTermination.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:31,代码来源:TestTermination.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:41,代码来源:TestTermination.java

示例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;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:32,代码来源:TestStreaming.java

示例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);
		}
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:16,代码来源:Reasoner.java

示例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);
		}
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:16,代码来源:Reasoner.java

示例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;
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:39,代码来源:PrintDictionary.java

示例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);

		}

	}
 
开发者ID:jrbn,项目名称:ajira,代码行数:79,代码来源:BenchmarkSorting.java


注:本文中的nl.vu.cs.ajira.submissions.Job.setActions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。