Skip to content

Commit

Permalink
always write status message
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jun 17, 2024
1 parent 055cfab commit c7ba91e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/cdlib/mrt/zk/QueueItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ public void setStatus(ZooKeeper client, IngestState status, String message) thro
if (message == null) {
message = "";
}
if (!message.isEmpty()) {
json.put(MerrittJsonKey.Message.key(), message);
}
json.put(MerrittJsonKey.Message.key(), message);

byte[] data = QueueItemHelper.asBytes(QueueItemHelper.serialize(json));
if (this.status == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/ruby/lib/merritt_zk_queue_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def set_status(zk, status, message = '')
return if status == @status

json = status_object(status)
json[:message] = message unless message.empty?
json[:message] = message
data = QueueItem.serialize(json)
if @status.nil?
zk.create(status_path, data)
Expand Down
41 changes: 41 additions & 0 deletions test-cases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ create_batch:
/batches/bid0/status:
status: Pending
last_modified: now
message: ''
create_and_load_batch:
input:
output:
Expand All @@ -45,6 +46,7 @@ create_and_load_batch:
/batches/bid0/status:
status: Pending
last_modified: now
message: ''
load_non_existent_batch:
input:
output:
Expand All @@ -58,6 +60,7 @@ batch_with_lock_unlock:
/batches/bid0/status:
status: Pending
last_modified: now
message: ''
batch_with_ephemeral_released_lock:
input:
output:
Expand All @@ -68,6 +71,7 @@ batch_with_ephemeral_released_lock:
/batches/bid0/status:
status: Pending
last_modified: now
message: ''
batch_with_unreleased_lock:
input:
output:
Expand All @@ -78,6 +82,7 @@ batch_with_unreleased_lock:
/batches/bid0/status:
status: Pending
last_modified: now
message: ''
/batches/bid0/lock: null
modify_batch_state:
input:
Expand All @@ -89,6 +94,7 @@ modify_batch_state:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
batch_acquire:
input:
output:
Expand All @@ -101,6 +107,7 @@ batch_acquire:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/batches/bid0/lock: null
/batches/bid1/submission:
foo: bar2
Expand All @@ -109,6 +116,7 @@ batch_acquire:
/batches/bid1/status:
status: Processing
last_modified: now
message: ''
/batches/bid1/lock: null
create_job:
input:
Expand All @@ -122,6 +130,7 @@ create_job:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
job: quack
Expand All @@ -132,6 +141,7 @@ create_job:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
create_job_state_change:
input:
Expand All @@ -145,6 +155,7 @@ create_job_state_change:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
job: quack
Expand All @@ -155,6 +166,7 @@ create_job_state_change:
status: Estimating
last_modified: now
retry_count: 0
message: ''
/jobs/states/estimating/05-jid0: null
load_job_state_change:
input:
Expand All @@ -168,6 +180,7 @@ load_job_state_change:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
job: quack
Expand All @@ -178,6 +191,7 @@ load_job_state_change:
status: Estimating
last_modified: now
retry_count: 0
message: ''
/jobs/states/estimating/05-jid0: null
acquire_pending_job:
input:
Expand All @@ -190,6 +204,7 @@ acquire_pending_job:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/lock: null
/jobs/jid0/configuration:
Expand All @@ -201,6 +216,7 @@ acquire_pending_job:
status: Estimating
last_modified: now
retry_count: 0
message: ''
/jobs/states/estimating/05-jid0: null
acquire_lowest_priority_job:
input:
Expand All @@ -215,6 +231,7 @@ acquire_lowest_priority_job:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
job: quack1
Expand All @@ -225,6 +242,7 @@ acquire_lowest_priority_job:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
/jobs/jid1/bid: bid0
/jobs/jid1/lock: null
Expand All @@ -237,6 +255,7 @@ acquire_lowest_priority_job:
status: Estimating
last_modified: now
retry_count: 0
message: ''
/jobs/states/estimating/02-jid1: null
/jobs/jid2/bid: bid0
/jobs/jid2/configuration:
Expand All @@ -248,6 +267,7 @@ acquire_lowest_priority_job:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid2: null
job_happy_path:
input:
Expand All @@ -262,6 +282,7 @@ job_happy_path:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
job: quack1
Expand All @@ -272,6 +293,7 @@ job_happy_path:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
/jobs/jid1/bid: bid0
/jobs/jid1/configuration:
Expand All @@ -283,6 +305,7 @@ job_happy_path:
status: Completed
last_modified: now
retry_count: 0
message: ''
/jobs/jid1/inventory:
manifest_url: http://storage.manifest.url
mode: tbd
Expand All @@ -297,6 +320,7 @@ job_happy_path:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid2: null
batch_happy_path:
input:
Expand All @@ -310,6 +334,7 @@ batch_happy_path:
/batches/bid0/status:
status: Completed
last_modified: now
message: ''
/jobs/jid1/bid: bid0
/jobs/jid1/configuration:
job: quack2
Expand All @@ -320,6 +345,7 @@ batch_happy_path:
status: Completed
last_modified: now
retry_count: 0
message: ''
/jobs/states/completed/02-jid1: null
batch_failure:
input:
Expand All @@ -333,6 +359,7 @@ batch_failure:
/batches/bid0/status:
status: Deleted
last_modified: now
message: ''
/jobs/jid1/bid: bid0
/jobs/jid1/configuration:
job: quack2
Expand All @@ -358,6 +385,7 @@ batch_recovery:
/batches/bid0/status:
status: Completed
last_modified: now
message: ''
/jobs/jid1/bid: bid0
/jobs/jid1/configuration:
job: quack2
Expand All @@ -368,6 +396,7 @@ batch_recovery:
status: Completed
last_modified: now
retry_count: 1
message: ''
/jobs/states/completed/02-jid1: null
job_happy_path_with_delete:
input:
Expand All @@ -382,6 +411,7 @@ job_happy_path_with_delete:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
job: quack1
Expand All @@ -392,6 +422,7 @@ job_happy_path_with_delete:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
/jobs/jid2/bid: bid0
/jobs/jid2/configuration:
Expand All @@ -403,6 +434,7 @@ job_happy_path_with_delete:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid2: null
batch_happy_path_with_delete:
input:
Expand All @@ -421,6 +453,7 @@ job_create_config:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
profile_name: a
Expand All @@ -435,6 +468,7 @@ job_create_config:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
job_create_config_ident:
input:
Expand All @@ -447,6 +481,7 @@ job_create_config_ident:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
profile_name: a
Expand All @@ -466,6 +501,7 @@ job_create_config_ident:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
job_create_config_ident_metadata:
input:
Expand All @@ -478,6 +514,7 @@ job_create_config_ident_metadata:
/batches/bid0/status:
status: Processing
last_modified: now
message: ''
/jobs/jid0/bid: bid0
/jobs/jid0/configuration:
profile_name: a
Expand All @@ -502,6 +539,7 @@ job_create_config_ident_metadata:
status: Pending
last_modified: now
retry_count: 0
message: ''
/jobs/states/pending/05-jid0: null
lock_ingest:
input:
Expand Down Expand Up @@ -535,6 +573,7 @@ access_happy_path:
/access/small/qid0/status:
status: Completed
last_modified: now
message: ''
access_happy_path_del:
input:
output:
Expand All @@ -546,6 +585,7 @@ access_fail_path:
/access/small/qid0/status:
status: Deleted
last_modified: now
message: ''
find_batch_by_uuid:
input:
output:
Expand All @@ -556,4 +596,5 @@ find_batch_by_uuid:
/batches/bid0/status:
status: Pending
last_modified: now
message: ''

0 comments on commit c7ba91e

Please sign in to comment.