// TODO be optimized is possible
 private TreeSet<Operation> dependedOperation(TreeSet<Operation> imports) {
   TreeSet<Operation> dependedOperations =
       Sets.newTreeSet(
           new Comparator<Operation>() {
             @Override
             public int compare(Operation o1, Operation o2) {
               return o1.getName().compareTo(o2.getName());
             }
           });
   for (Operation operation : imports) {
     if (operation.getImports() != null) dependedOperations.addAll(operation.getImports());
   }
   return dependedOperations;
 }
  @Override
  public String createTask(Graph<Operation, EdgeType> graph, String hostname) {
    logger.info("create task script for host:" + hostname);
    List<ByteSource> byteSources = Lists.newArrayList();
    TreeSet<Operation> imports =
        Sets.newTreeSet(
            new Comparator<Operation>() {
              @Override
              public int compare(Operation o1, Operation o2) {
                return o1.getName().compareTo(o2.getName());
              }
            });
    StringBuilder builder = new StringBuilder();
    String changeLine = System.getProperty("line.separator");

    builder.append(changeLine + "node '" + hostname + "'{" + changeLine);
    String definedContent = opBuilder.createDefineContent(graph, imports, null);
    builder.append(definedContent);
    builder.append(changeLine + "}");

    logger.debug(builder.toString());

    imports.addAll(dependedOperation(imports));
    try {
      for (Operation operation : imports) {
        if (operation.getDefineMd5() != null) {
          byteSources.add(fileService.findFile(operation.getDefineMd5()));
        }
      }
      byteSources.add(ByteSource.wrap(builder.toString().getBytes()));
      String md5Key = fileService.saveFile(ByteSource.concat(byteSources));
      logger.info("the md5key of this task script is" + md5Key);
      logger.info("create task script successful");
      return md5Key;
    } catch (IOException e) {
      logger.error("store task script file failed");
      e.printStackTrace();
    }
    return null;
  }