public List<String> getProcessClusterNames(
      List<org.apache.falcon.entity.v0.process.Cluster> clusters) {
    List<String> clusterNames = new ArrayList<String>(clusters.size());
    for (org.apache.falcon.entity.v0.process.Cluster cluster : clusters) {
      clusterNames.add(cluster.getName());
    }

    return clusterNames;
  }
示例#2
0
  private Clusters buildClusters(String name) {
    Validity validity = new Validity();
    long startMilliSecs = new Date().getTime() - (2 * DAY_IN_MILLIS);
    validity.setStart(new Date(startMilliSecs));
    validity.setEnd(new Date());
    org.apache.falcon.entity.v0.process.Cluster cluster =
        new org.apache.falcon.entity.v0.process.Cluster();
    cluster.setName(name);
    cluster.setValidity(validity);

    Clusters clusters = new Clusters();
    clusters.getClusters().add(cluster);
    return clusters;
  }
  private static void bindClusterProperties(
      final Cluster cluster, final Properties extensionProperties) {
    String clusterName =
        extensionProperties.getProperty(ExtensionProperties.CLUSTER_NAME.getName());
    if (StringUtils.isNotEmpty(clusterName)) {
      cluster.setName(clusterName);
    }
    String clusterStartValidity =
        extensionProperties.getProperty(ExtensionProperties.VALIDITY_START.getName());
    if (StringUtils.isNotEmpty(clusterStartValidity)) {
      cluster.getValidity().setStart(SchemaHelper.parseDateUTC(clusterStartValidity));
    }

    String clusterEndValidity =
        extensionProperties.getProperty(ExtensionProperties.VALIDITY_END.getName());
    if (StringUtils.isNotEmpty(clusterEndValidity)) {
      cluster.getValidity().setEnd(SchemaHelper.parseDateUTC(clusterEndValidity));
    }
  }
  public void addProcessEntity(Process process) {
    String processName = process.getName();
    LOG.info("Adding process entity: {}", processName);
    Vertex processVertex = addVertex(processName, RelationshipType.PROCESS_ENTITY);
    addWorkflowProperties(process.getWorkflow(), processVertex, processName);

    addUserRelation(processVertex);
    addDataClassification(process.getTags(), processVertex);
    addPipelines(process.getPipelines(), processVertex);

    for (org.apache.falcon.entity.v0.process.Cluster cluster :
        process.getClusters().getClusters()) {
      addRelationToCluster(
          processVertex, cluster.getName(), RelationshipLabel.PROCESS_CLUSTER_EDGE);
    }

    addInputFeeds(process.getInputs(), processVertex);
    addOutputFeeds(process.getOutputs(), processVertex);
  }
  public void updateProcessClusters(
      List<org.apache.falcon.entity.v0.process.Cluster> oldClusters,
      List<org.apache.falcon.entity.v0.process.Cluster> newClusters,
      Vertex processEntityVertex) {
    if (areProcessClustersSame(oldClusters, newClusters)) {
      return;
    }

    // remove old clusters
    for (org.apache.falcon.entity.v0.process.Cluster oldCuster : oldClusters) {
      removeEdge(
          processEntityVertex,
          oldCuster.getName(),
          RelationshipLabel.PROCESS_CLUSTER_EDGE.getName());
    }

    // add new clusters
    for (org.apache.falcon.entity.v0.process.Cluster newCluster : newClusters) {
      addRelationToCluster(
          processEntityVertex, newCluster.getName(), RelationshipLabel.PROCESS_CLUSTER_EDGE);
    }
  }