Skip to content

Commit

Permalink
enqueue jobs with pointset IDs when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Jun 8, 2015
1 parent a59f60e commit b96c5db
Showing 1 changed file with 9 additions and 6 deletions.
Expand Up @@ -21,12 +21,11 @@
*/ */
public class JobSimulator { public class JobSimulator {


public static final String QUEUE_PREFIX = "analyst-dev_";

public static void main(String[] args) { public static void main(String[] args) {


String prefix = args[0]; String prefix = args[0];
String graphId = args[1]; String pointSetId = args[1];
String graphId = pointSetId.split("_")[0];
int nOrigins = Integer.parseInt(args[2]); int nOrigins = Integer.parseInt(args[2]);


String jobId = compactUUID(); String jobId = compactUUID();
Expand All @@ -40,17 +39,21 @@ public static void main(String[] args) {
sqs.setRegion(awsRegion); sqs.setRegion(awsRegion);


// Create a queue for this job // Create a queue for this job
String queueUrl = sqs.createQueue(String.join("_", prefix, "job", graphId, jobId)).getQueueUrl(); String taskQueueUrl = sqs.createQueue(String.join("_", prefix, "job", graphId, jobId)).getQueueUrl();
String resultQueueUrl = sqs.createQueue(String.join("_", prefix, "job", graphId, jobId)).getQueueUrl();


ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
IntStream.range(0, nOrigins).forEach(i -> { IntStream.range(0, nOrigins).forEach(i -> {
// Enqueue one fake origin // Enqueue one fake origin
ProfileRequest profileRequest = new ProfileRequest(); ProfileRequest profileRequest = new ProfileRequest();
AnalystClusterRequest clusterRequest = new OneToManyProfileRequest(null, profileRequest, graphId); AnalystClusterRequest clusterRequest = new OneToManyProfileRequest(pointSetId, profileRequest, graphId);
clusterRequest.id = Integer.toString(i); clusterRequest.id = Integer.toString(i);
clusterRequest.jobId = jobId; clusterRequest.jobId = jobId;
clusterRequest.outputLocation = prefix + "_output";
clusterRequest.outputQueue = resultQueueUrl;
clusterRequest.destinationPointsetId = pointSetId;
try { try {
sqs.sendMessage(queueUrl, objectMapper.writeValueAsString(clusterRequest)); sqs.sendMessage(taskQueueUrl, objectMapper.writeValueAsString(clusterRequest));
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
} }
Expand Down

0 comments on commit b96c5db

Please sign in to comment.