Package org.apache.helix.task

Examples of org.apache.helix.task.TaskConfig


  public void testDifferentTasks() throws Exception {
    // Create a job with two different tasks
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", null, true);
    TaskConfig taskConfig2 = new TaskConfig("TaskTwo", null, true);
    taskConfigs.add(taskConfig1);
    taskConfigs.add(taskConfig2);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    Map<String, String> jobConfigMap = Maps.newHashMap();
View Full Code Here


    // Create a job with two different tasks
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    Map<String, String> taskConfigMap = Maps.newHashMap(ImmutableMap.of("fail", "" + true));
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", taskConfigMap, false);
    TaskConfig taskConfig2 = new TaskConfig("TaskTwo", null, false);
    taskConfigs.add(taskConfig1);
    taskConfigs.add(taskConfig2);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    workflowBuilder.addConfig(jobName, JobConfig.FAILURE_THRESHOLD, "" + 1);
View Full Code Here

    // Create a job with two different tasks
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    Map<String, String> taskConfigMap = Maps.newHashMap(ImmutableMap.of("fail", "" + true));
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", taskConfigMap, true);
    TaskConfig taskConfig2 = new TaskConfig("TaskTwo", null, false);
    taskConfigs.add(taskConfig1);
    taskConfigs.add(taskConfig2);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    Map<String, String> jobConfigMap = Maps.newHashMap();
View Full Code Here

    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    Map<String, String> taskConfigMap =
        Maps.newHashMap(ImmutableMap.of("fail", "" + true, "failInstance", "localhost_"
            + START_PORT));
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", taskConfigMap, false);
    taskConfigs.add(taskConfig1);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    workflowBuilder.addConfig(jobName, JobConfig.MAX_FORCED_REASSIGNMENTS_PER_TASK, ""
        + (NUM_INSTANCES - 1)); // this ensures that every instance gets one chance
View Full Code Here

  public void testOneTimeScheduled() throws Exception {
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(1);
    Map<String, String> taskConfigMap = Maps.newHashMap();
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", taskConfigMap, false);
    taskConfigs.add(taskConfig1);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    Map<String, String> jobConfigMap = Maps.newHashMap();
    jobConfigMap.put("Timeout", "1000");
View Full Code Here

    int delay = 3000;
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(1);
    Map<String, String> taskConfigMap = Maps.newHashMap();
    TaskConfig taskConfig1 = new TaskConfig("SingleFailTask", taskConfigMap, false);
    taskConfigs.add(taskConfig1);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    workflowBuilder.addConfig(jobName, JobConfig.TASK_RETRY_DELAY, String.valueOf(delay));
    Map<String, String> jobConfigMap = Maps.newHashMap();
View Full Code Here

    public TaskOne(TaskCallbackContext context, String instanceName) {
      super(context);

      // Check whether or not this task should succeed
      TaskConfig taskConfig = context.getTaskConfig();
      boolean shouldFail = false;
      if (taskConfig != null) {
        Map<String, String> configMap = taskConfig.getConfigMap();
        if (configMap != null && configMap.containsKey("fail")
            && Boolean.parseBoolean(configMap.get("fail"))) {
          // if a specific instance is specified, only fail for that one
          shouldFail =
              !configMap.containsKey("failInstance")
View Full Code Here

  public void testDifferentTasks() throws Exception {
    // Create a job with two different tasks
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", null, true);
    TaskConfig taskConfig2 = new TaskConfig("TaskTwo", null, true);
    taskConfigs.add(taskConfig1);
    taskConfigs.add(taskConfig2);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    Map<String, String> jobConfigMap = Maps.newHashMap();
View Full Code Here

    // Create a job with two different tasks
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    Map<String, String> taskConfigMap = Maps.newHashMap(ImmutableMap.of("fail", "" + true));
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", taskConfigMap, false);
    TaskConfig taskConfig2 = new TaskConfig("TaskTwo", null, false);
    taskConfigs.add(taskConfig1);
    taskConfigs.add(taskConfig2);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    workflowBuilder.addConfig(jobName, JobConfig.FAILURE_THRESHOLD, "" + 1);
View Full Code Here

    // Create a job with two different tasks
    String jobName = TestHelper.getTestMethodName();
    Workflow.Builder workflowBuilder = new Workflow.Builder(jobName);
    List<TaskConfig> taskConfigs = Lists.newArrayListWithCapacity(2);
    Map<String, String> taskConfigMap = Maps.newHashMap(ImmutableMap.of("fail", "" + true));
    TaskConfig taskConfig1 = new TaskConfig("TaskOne", taskConfigMap, true);
    TaskConfig taskConfig2 = new TaskConfig("TaskTwo", null, false);
    taskConfigs.add(taskConfig1);
    taskConfigs.add(taskConfig2);
    workflowBuilder.addTaskConfigs(jobName, taskConfigs);
    workflowBuilder.addConfig(jobName, JobConfig.COMMAND, "DummyCommand");
    Map<String, String> jobConfigMap = Maps.newHashMap();
View Full Code Here

TOP

Related Classes of org.apache.helix.task.TaskConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.