public static String extractMinionInstanceTag(TableConfig tableConfig, String taskType) {
    TableTaskConfig tableTaskConfig = tableConfig.getTaskConfig();
    if (tableTaskConfig != null) {
      Map<String, String> configs = tableTaskConfig.getConfigsForTaskType(taskType);
      if (configs != null && !configs.isEmpty()) {
        return configs.getOrDefault(PinotTaskManager.MINION_INSTANCE_TAG_CONFIG,
            CommonConstants.Helix.UNTAGGED_MINION_INSTANCE);
      }
    }
    return CommonConstants.Helix.UNTAGGED_MINION_INSTANCE;
  }
@Test
  public void testExtractMinionInstanceTag() {
    // correct minionInstanceTag extraction
    Map<String, String> tableTaskConfigs = getDummyTaskConfig();
    tableTaskConfigs.put(PinotTaskManager.MINION_INSTANCE_TAG_CONFIG, "minionInstance1");
    TableTaskConfig tableTaskConfig =
        new TableTaskConfig(Collections.singletonMap(MinionConstants.MergeRollupTask.TASK_TYPE, tableTaskConfigs));
    TableConfig tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName("sampleTable")
        .setTaskConfig(tableTaskConfig).build();
    assertEquals(TaskGeneratorUtils.extractMinionInstanceTag(tableConfig,
        MinionConstants.MergeRollupTask.TASK_TYPE), "minionInstance1");

    // no minionInstanceTag passed
    tableTaskConfigs = getDummyTaskConfig();
    tableTaskConfig =
        new TableTaskConfig(Collections.singletonMap(MinionConstants.MergeRollupTask.TASK_TYPE, tableTaskConfigs));
    tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName("sampleTable")
        .setTaskConfig(tableTaskConfig).build();
    assertEquals(TaskGeneratorUtils.extractMinionInstanceTag(tableConfig,
        MinionConstants.MergeRollupTask.TASK_TYPE), CommonConstants.Helix.UNTAGGED_MINION_INSTANCE);
  }