pushmi_pullyu 2.1.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da4560ad8303a06ea455d4da2915bd9be6a98edb70a8ee91bc12cb25d977f3b5
4
- data.tar.gz: db98dc991f3149b0d217f6ae61f9c07c34ecc8ab7c878d4e60ecdbc08aed95bd
3
+ metadata.gz: efbf0435968a4a9c78b8ff2c5052a1b872277085ee6d849ccf973f468bcf806b
4
+ data.tar.gz: 98bb7ec8dcd874876235bb4f7c41272e2a033f9c014e3efb78c834344d1ab72a
5
5
  SHA512:
6
- metadata.gz: 5d565b6ecf4fcd0cab2690f04aaf619dc70d83848a8fc48960de393fac94b83ff18f9751528dbbb184c4f411d270113ec90c807146c8c14e35010c8a40434734
7
- data.tar.gz: 478f4047534baaf2931733f0f48d199dd51088262e0076f5b52ad1f63f74fb5fee6dc5265ec8c8b5064f8b87d1ecaebf94513a5d9ecf299c3455df4526fbc9cb
6
+ metadata.gz: beec01dfe70827e3f0dac9289d4a11e63a98b9df2077a8343a46ac2b58de32be4cf634d7fd0f9cb22763b58083de6dbecd10a98e783b491e61dbef4f56ea77df
7
+ data.tar.gz: add946bc1f39b790fd7bee843e95b55785df90169ae3fa719d322db6e2282dcd0f8615f6be25fc4512ecdfc0467ae9ba5efdc7192398ffb685d5d0d90261cc99
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ PushmiPullyu is a Ruby application, whose primary job is to manage the flow of c
6
6
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7
7
  and releases in PushmiPullyu adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [2.1.2]
10
+ - Simplify get entity code [#280](https://github.com/ualbertalib/pushmi_pullyu/issues/280)
11
+
12
+ ## [2.1.1]
13
+ - Increase clarity of log files [#433](https://github.com/ualbertalib/pushmi_pullyu/issues/433)
14
+
9
15
  ## [2.1.0]
10
16
  - Add more logging information [#433](https://github.com/ualbertalib/pushmi_pullyu/issues/433)
11
17
  - Add V3 authentication [#349](https://github.com/ualbertalib/pushmi_pullyu/issues/349)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pushmi_pullyu (2.1.0)
4
+ pushmi_pullyu (2.1.2)
5
5
  activesupport (>= 5, < 8)
6
6
  bagit (~> 0.4)
7
7
  connection_pool (~> 2.2)
@@ -199,13 +199,14 @@ class PushmiPullyu::CLI
199
199
  def run_preservation_cycle
200
200
  begin
201
201
  entity = queue.wait_next_item
202
- PushmiPullyu::Logging.log_preservation_attempt(entity,
203
- queue.get_entity_ingestion_attempt(entity))
204
- return unless entity && entity[:type].present? && entity[:uuid].present?
205
202
  rescue StandardError => e
206
203
  log_exception(e)
207
204
  end
208
205
 
206
+ return unless entity && entity[:type].present? && entity[:uuid].present?
207
+
208
+ PushmiPullyu::Logging.log_preservation_attempt(entity,
209
+ queue.get_entity_ingestion_attempt(entity))
209
210
  # add additional information about the error context to errors that occur while processing this item.
210
211
  Rollbar.scoped(entity_uuid: entity[:uuid]) do
211
212
  # Download AIP from Jupiter, bag and tar AIP directory and cleanup after
@@ -214,7 +215,7 @@ class PushmiPullyu::CLI
214
215
  # Push tarred AIP to swift API
215
216
  deposited_file = swift.deposit_file(aip_filename, options[:swift][:container])
216
217
  # Log successful preservation event to the log files
217
- PushmiPullyu::Logging.log_preservation_success(deposited_file, aip_directory)
218
+ PushmiPullyu::Logging.log_preservation_success(entity, deposited_file, aip_directory)
218
219
  end
219
220
  # An EntityInvalid expection means there is a problem with the entity information format so there is no point in
220
221
  # readding it to the queue as it will always fail
@@ -225,7 +226,7 @@ class PushmiPullyu::CLI
225
226
  queue.add_entity_in_timeframe(entity)
226
227
  PushmiPullyu::Logging.log_preservation_fail_and_retry(entity, queue.get_entity_ingestion_attempt(entity), e)
227
228
  rescue PushmiPullyu::PreservationQueue::MaxDepositAttemptsReached => e
228
- PushmiPullyu::Logging.log_preservation_failure(entity, queue.get_entity_ingestion_attempt(entity), e)
229
+ PushmiPullyu::Logging.log_preservation_failure(entity, PushmiPullyu.options[:ingestion_attempts], e)
229
230
  log_exception(e)
230
231
  end
231
232
 
@@ -52,7 +52,7 @@ module PushmiPullyu::Logging
52
52
  @preservation_json_logger.info("#{message_json},")
53
53
  end
54
54
 
55
- def log_preservation_success(deposited_file, aip_directory)
55
+ def log_preservation_success(entity, deposited_file, aip_directory)
56
56
  message = "#{deposited_file.name} was successfully deposited into Swift Storage!\n" \
57
57
  "Here are the details of this preservation event:\n" \
58
58
  "\tUUID: '#{deposited_file.name}'\n" \
@@ -74,14 +74,24 @@ module PushmiPullyu::Logging
74
74
  end
75
75
  end
76
76
 
77
- log_preservation_event(message, preservation_success_to_json(deposited_file, aip_directory))
77
+ message_information = {
78
+ event_type: :success,
79
+ event_time: Time.now.to_s,
80
+ entity_type: entity[:type],
81
+ entity_uuid: entity[:uuid],
82
+ event_details: preservation_success_to_json(deposited_file, aip_directory)
83
+ }
84
+
85
+ log_preservation_event(message, message_information.to_json)
78
86
  end
79
87
 
80
- def log_preservation_fail_and_retry(entity, retry_attempt, exception)
88
+ def log_preservation_fail_and_retry(entity, try_attempt, exception)
89
+ # We add + 1 to try_attempt because humans like to start counting from 1
90
+ try_attempt += 1
81
91
  message = "#{entity[:type]} failed to be deposited and will try again.\n" \
82
92
  "Here are the details of this preservation event:\n" \
83
93
  "\t#{entity[:type]} uuid: #{entity[:uuid]}" \
84
- "\tReadding to preservation queue with retry attempt: #{retry_attempt}\n" \
94
+ "\tReadding to preservation queue with try attempt: #{try_attempt}\n" \
85
95
  "\tError of type: #{exception.class.name}\n" \
86
96
  "\tError message: #{exception.message}\n"
87
97
 
@@ -90,43 +100,47 @@ module PushmiPullyu::Logging
90
100
  event_time: Time.now.to_s,
91
101
  entity_type: entity[:type],
92
102
  entity_uuid: entity[:uuid],
93
- retry_attempt: retry_attempt,
103
+ try_attempt: try_attempt,
94
104
  error_message: exception.message
95
105
  }
96
106
 
97
107
  log_preservation_event(message, message_information.to_json)
98
108
  end
99
109
 
100
- def log_preservation_failure(entity, retry_attempt, exception)
110
+ def log_preservation_failure(entity, try_attempt, exception)
111
+ # We add + 1 to try_attempt because humans like to start counting from 1
112
+ try_attempt += 1
101
113
  message = "#{entity[:type]} failed to be deposited.\n" \
102
114
  "Here are the details of this preservation event:\n" \
103
115
  "\t#{entity[:type]} uuid: #{entity[:uuid]}" \
104
- "\tRetry attempt: #{retry_attempt}\n"
116
+ "\tTry attempt: #{try_attempt}\n"
105
117
 
106
118
  message_information = {
107
- event_type: :fail_and_retry,
119
+ event_type: :failure,
108
120
  event_time: Time.now.to_s,
109
121
  entity_type: entity[:type],
110
122
  entity_uuid: entity[:uuid],
111
- retry_attempt: retry_attempt,
123
+ try_attempt: try_attempt,
112
124
  error_message: exception.message
113
125
  }
114
126
 
115
127
  log_preservation_event(message, message_information.to_json)
116
128
  end
117
129
 
118
- def log_preservation_attempt(entity, retry_attempt)
130
+ def log_preservation_attempt(entity, try_attempt)
131
+ # We add + 1 to try_attempt because humans like to start counting from 1
132
+ try_attempt += 1
119
133
  message = "#{entity[:type]} will attempt to be deposited.\n" \
120
134
  "Here are the details of this preservation event:\n" \
121
135
  "\t#{entity[:type]} uuid: #{entity[:uuid]}" \
122
- "\tRetry attempt: #{retry_attempt}\n"
136
+ "\tTry attempt: #{try_attempt}\n"
123
137
 
124
138
  message_information = {
125
139
  event_type: :attempt,
126
140
  event_time: Time.now.to_s,
127
141
  entity_type: entity[:type],
128
142
  entity_uuid: entity[:uuid],
129
- retry_attempt: retry_attempt
143
+ try_attempt: try_attempt
130
144
  }
131
145
 
132
146
  log_preservation_event(message, message_information.to_json)
@@ -184,7 +198,7 @@ module PushmiPullyu::Logging
184
198
  end
185
199
 
186
200
  message['aip_file_details'] = tmp_details
187
- message.to_json
201
+ message
188
202
  end
189
203
 
190
204
  def reopen
@@ -73,7 +73,7 @@ class PushmiPullyu::PreservationQueue
73
73
  def get_entity_ingestion_attempt(entity)
74
74
  entity_attempts_key = "#{PushmiPullyu.options[:ingestion_prefix]}#{entity[:uuid]}"
75
75
  @redis.with do |connection|
76
- return connection.get entity_attempts_key
76
+ return connection.get(entity_attempts_key).to_i
77
77
  end
78
78
  end
79
79
 
@@ -1,3 +1,3 @@
1
1
  module PushmiPullyu
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushmi_pullyu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Murnaghan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-05-27 00:00:00.000000000 Z
12
+ date: 2024-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -294,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  - !ruby/object:Gem::Version
295
295
  version: '0'
296
296
  requirements: []
297
- rubygems_version: 3.3.26
297
+ rubygems_version: 3.1.6
298
298
  signing_key:
299
299
  specification_version: 4
300
300
  summary: Ruby application to manage flow of content from Jupiter into Swift for preservation