use of org.apache.reef.tang.JavaConfigurationBuilder in project mist by snuspl.
the class MQTTNoiseSensing method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer());
sinkServer.start();
final APIQueryControlResult result = submitQuery(jcb.build());
System.out.println("Query submission result: " + result.getQueryId());
}
use of org.apache.reef.tang.JavaConfigurationBuilder in project mist by snuspl.
the class QueryDeletion method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).registerShortNameOfClass(// Additional parameter
NettySourceAddress.class).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer());
sinkServer.start();
final APIQueryControlResult result = submitQuery(jcb.build());
result.getMsg();
Thread.sleep(10000);
System.out.println(MISTQueryControl.delete("example-group", result.getQueryId(), result.getTaskAddress()).getMsg());
}
use of org.apache.reef.tang.JavaConfigurationBuilder in project mist by snuspl.
the class RuleBasedStatefulExample method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).registerShortNameOfClass(// Additional parameter
NettySourceAddress.class).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer());
sinkServer.start();
final APIQueryControlResult result = submitQuery(jcb.build());
System.out.println("Query submission result: " + result.getQueryId());
}
use of org.apache.reef.tang.JavaConfigurationBuilder in project mist by snuspl.
the class ImmediateQueryMergingStarterTest method setUp.
@Before
public void setUp() throws InjectionException, IOException {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
jcb.bindImplementation(ExecutionDags.class, MergingExecutionDags.class);
jcb.bindImplementation(QueryStarter.class, ImmediateQueryMergingStarter.class);
idAndConfGenerator = new IdAndConfGenerator();
executionVertexGenerator = mock(ExecutionVertexGenerator.class);
final Injector injector = Tang.Factory.getTang().newInjector(jcb.build());
injector.bindVolatileInstance(ExecutionVertexGenerator.class, executionVertexGenerator);
configExecutionVertexMap = injector.getInstance(ConfigExecutionVertexMap.class);
executionVertexCountMap = injector.getInstance(ExecutionVertexCountMap.class);
executionVertexDagMap = injector.getInstance(ExecutionVertexDagMap.class);
executionDags = injector.getInstance(ExecutionDags.class);
queryIdConfigDagMap = injector.getInstance(QueryIdConfigDagMap.class);
srcAndDagMap = injector.getInstance(SrcAndDagMap.class);
queryStarter = injector.getInstance(QueryStarter.class);
configVertexId = new AtomicLong();
}
use of org.apache.reef.tang.JavaConfigurationBuilder in project mist by snuspl.
the class MistLauncher method run.
/**
* Run the Mist Driver for the given options.
* @param numTaskCores the number of cores for tasks
* @param numEventProcessors the number of event processors
* @param numTasks the number of tasks
* @param taskMemorySize the Memory size of the task
* @param numMasterCores the number of cores for master
* @param masterMemorySize the memory size allocated for master
* @return a status of the driver
* @throws InjectionException on configuration errors
*/
public LauncherStatus run(final int numTaskCores, final int numEventProcessors, final int numTasks, final int taskMemorySize, final int numMasterCores, final int masterMemorySize) throws InjectionException {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
jcb.bindNamedParameter(NumTaskCores.class, Integer.toString(numTaskCores));
jcb.bindNamedParameter(DefaultNumEventProcessors.class, Integer.toString(numEventProcessors));
jcb.bindNamedParameter(NumTasks.class, Integer.toString(numTasks));
jcb.bindNamedParameter(TaskMemorySize.class, Integer.toString(taskMemorySize));
jcb.bindNamedParameter(NumMasterCores.class, Integer.toString(numMasterCores));
jcb.bindNamedParameter(MasterMemorySize.class, Integer.toString(masterMemorySize));
return runFromConf(jcb.build());
}
Aggregations