Java Code Examples for org.apache.reef.driver.evaluator.AllocatedEvaluator#submitTask()

The following examples show how to use org.apache.reef.driver.evaluator.AllocatedEvaluator#submitTask() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskMessagingDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator eval) {
  final String taskId = "Task_" + eval.getId();
  LOG.log(Level.INFO, "Submit task: {0}", taskId);

  final Configuration taskConfig = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, taskId)
      .set(TaskConfiguration.TASK, TaskMessagingTask.class)
      .set(TaskConfiguration.ON_MESSAGE, TaskMessagingTask.DriverMessageHandler.class)
      .set(TaskConfiguration.ON_SEND_MESSAGE, TaskMessagingTask.class)
      .build();
  eval.submitTask(taskConfig);
}
 
Example 2
Source File: RogueThreadDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "RogueThreadTestTask")
      .set(TaskConfiguration.TASK, RogueThreadTask.class)
      .build();
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 3
Source File: EvaluatorCloseDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  LOG.log(Level.FINE, "Received a AllocatedEvaluator for Evaluator {0}", allocatedEvaluator.getId());
  evaluator = allocatedEvaluator;
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "EvaluatorCloseTestTask")
      .set(TaskConfiguration.TASK, EvaluatorCloseTestTask.class)
      .build();
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 4
Source File: EvaluatorExitTestDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "EvaluatorExitTestTask")
      .set(TaskConfiguration.TASK, EvaluatorExitTestTask.class)
      .build();
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 5
Source File: EvaluatorCompleteTestDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "EvaluatorCompleteTestTask")
      .set(TaskConfiguration.TASK, EvaluatorCompleteTestTask.class)
      .build();
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 6
Source File: TaskCountingDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  synchronized (expectedRunningTaskIds) {
    final String taskId = "Task-" + numberOfTaskSubmissions.getAndDecrement();
    final Configuration taskConfiguration = getTaskConfiguration(taskId);
    allocatedEvaluator.submitTask(taskConfiguration);
    expectedRunningTaskIds.add(taskId);
  }
}
 
Example 7
Source File: ConfigurationProviderTestDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  allocatedEvaluator.submitTask(TaskConfiguration.CONF
      .set(TaskConfiguration.TASK, ConfigurationProviderTestTask.class)
      .set(TaskConfiguration.IDENTIFIER, "ConfigurationProviderTestTask")
      .build());
}
 
Example 8
Source File: EvaluatorSizeTestDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {

  final int evaluatorMemory = allocatedEvaluator.getEvaluatorDescriptor().getMemory();

  if (evaluatorMemory < EvaluatorSizeTestDriver.this.memorySize) {
    throw new DriverSideFailure(
        "Got an Evaluator with too little RAM. Asked for " + EvaluatorSizeTestDriver.this.memorySize
            + "MB, but got " + evaluatorMemory + "MB.");
  }

  // ALL good on the Driver side. Let's move on to the Task
  try {
    final Configuration taskConfiguration = TaskConfiguration.CONF
        .set(TaskConfiguration.TASK, MemorySizeTask.class)
        .set(TaskConfiguration.IDENTIFIER, "EvaluatorSizeTestTask")
        .build();

    final Configuration testConfiguration = EvaluatorSizeTestConfiguration.CONF
        .set(EvaluatorSizeTestConfiguration.MEMORY_SIZE, EvaluatorSizeTestDriver.this.memorySize)
        .build();

    final Configuration mergedTaskConfiguration = Tang.Factory.getTang()
        .newConfigurationBuilder(taskConfiguration, testConfiguration).build();

    allocatedEvaluator.submitTask(mergedTaskConfiguration);

  } catch (final BindException e) {
    throw new DriverSideFailure("Unable to launch Task", e);
  }
}
 
Example 9
Source File: HelloDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  LOG.log(Level.INFO, "Submitting HelloREEF task to AllocatedEvaluator: {0}", allocatedEvaluator);
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "HelloREEFTask")
      .set(TaskConfiguration.TASK, HelloTask.class)
      .build();
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 10
Source File: HelloJVMOptionsDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  LOG.log(Level.INFO, "Submitting HelloREEF task to AllocatedEvaluator: {0}", allocatedEvaluator);
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "HelloREEFTask")
      .set(TaskConfiguration.TASK, HelloTask.class)
      .build();
  final JVMProcess jvmProcess = jvmProcessFactory.newEvaluatorProcess()
      .setMemory(56)
      .addOption("-Xdiag")
      .addOption("-XX:+PrintCommandLineFlags")
      .addOption("-XX:+PrintGCDetails");
  allocatedEvaluator.setProcess(jvmProcess);
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 11
Source File: HelloMultiRuntimeDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  LOG.log(Level.INFO, "Submitting HelloREEF task to AllocatedEvaluator: {0}", allocatedEvaluator);
  final Configuration taskConfiguration = TaskConfiguration.CONF
      .set(TaskConfiguration.IDENTIFIER, "HelloREEFTask")
      .set(TaskConfiguration.TASK, HelloTask.class)
      .build();
  allocatedEvaluator.submitTask(taskConfiguration);
}
 
Example 12
Source File: TaskResubmitDriver.java    From reef with Apache License 2.0 4 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {
  allocatedEvaluator.submitTask(getTaskConfiguration());
}
 
Example 13
Source File: ShellDriver.java    From reef with Apache License 2.0 3 votes vote down vote up
@Override
public void onNext(final AllocatedEvaluator allocatedEvaluator) {

  LOG.log(Level.INFO,
      "Submitting command {0} task to evaluator: {1}", new Object[] {command, allocatedEvaluator});

  final JavaConfigurationBuilder taskConfigBuilder =
      Tang.Factory.getTang().newConfigurationBuilder(STATIC_TASK_CONFIG);

  taskConfigBuilder.bindNamedParameter(Command.class, command);

  allocatedEvaluator.submitTask(taskConfigBuilder.build());
}