ResourceInstance createTaskResource(String clusterName, String requestId, String stageId, String taskId) {
    Map<Resource.Type,String> mapIds = new HashMap<>();
    mapIds.put(Resource.Type.Cluster, clusterName);
    mapIds.put(Resource.Type.Request, requestId);
    mapIds.put(Resource.Type.Stage, stageId);
    mapIds.put(Resource.Type.Task, taskId);

    return createResource(Resource.Type.Task, mapIds);
  }
Create a task resource instance.

@param clusterName  cluster name
@param requestId    request id
@param stageId      stage id
@param taskId       task id

@return a task resource instance
ambari-server/src/main/java/org/apache/ambari/server/api/services/TaskService.java