Skip to content

Commit

Permalink
Configure export to use AWS Batch jobid as export id when available
Browse files Browse the repository at this point in the history
  • Loading branch information
Cole-Greer committed Jul 11, 2024
1 parent c9dac01 commit 5b9421f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package com.amazonaws.services.neptune.cluster;

import com.amazonaws.services.neptune.AmazonNeptune;
import org.apache.commons.lang.StringUtils;

import java.util.UUID;
import java.util.function.Supplier;
Expand Down Expand Up @@ -51,7 +52,11 @@ public Cluster cloneCluster(ConnectionConfig connectionConfig, ConcurrencyConfig
}

String clusterId = originalClusterMetadata.clusterId();
String targetClusterId = String.format("neptune-export-cluster-%s", UUID.randomUUID().toString().substring(0, 5));
String targetClusterIdSuffix = System.getenv("AWS_BATCH_JOB_ID"); // Use AWS Batch job id if running in Neptune Export Service
if (StringUtils.isEmpty(targetClusterIdSuffix)) {
targetClusterIdSuffix = UUID.randomUUID().toString().substring(0, 5);
}
String targetClusterId = String.format("neptune-export-cluster-%s", targetClusterIdSuffix);

AddCloneTask addCloneTask = new AddCloneTask(
clusterId,
Expand Down

0 comments on commit 5b9421f

Please sign in to comment.