Skip to content

Commit

Permalink
lock job on create
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jun 14, 2024
1 parent bafd554 commit 6f45397
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ phases:
- cp -r src/main/ruby/doc/* api/ruby
- echo aws s3 cp --recursive api s3://${S3CFBUCKET}/api
- aws s3 cp --recursive api s3://${S3CFBUCKET}/api
# recommendation from Brian
# - aws cloudfront create-invalidation --distribution-id #{cf_distro} --paths /dmps/* --region #{GLOBAL_REGION}`
post_build:
commands:
#- aws s3 rm s3://${S3CFBUCKET}/api --recursive
4 changes: 4 additions & 0 deletions src/main/java/org/cdlib/mrt/zk/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ public static Job createJob(ZooKeeper client, String bid, int priority, JSONObje
public static Job createJob(ZooKeeper client, String bid, int priority, JSONObject configuration, JSONObject identifiers, JSONObject metadata) throws MerrittZKNodeInvalid, KeeperException, InterruptedException, MerrittStateError {
String id = QueueItemHelper.createId(client, Job.prefixPath());
Job job = new Job(id, bid, configuration);
if (!job.lock(client)) {
return null;
}
job.createData(client, ZKKey.JOB_BID, bid);
job.createData(client, ZKKey.JOB_PRIORITY, job.priority);
job.createData(client, ZKKey.JOB_SPACE_NEEDED, job.spaceNeeded);
Expand All @@ -212,6 +215,7 @@ public static Job createJob(ZooKeeper client, String bid, int priority, JSONObje
job.setStatusWithPriority(client, Job.initStatus(), priority);
job.setBatchStatePath(client);
job.setJobStatePath(client);
job.unlock(client);
return job;
}

Expand Down

0 comments on commit 6f45397

Please sign in to comment.