ddr-batch 1.5.1 → 1.6.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/mailers/ddr/batch/batch_processor_run_mailer.rb +18 -1
- data/app/models/ddr/batch/batch.rb +6 -0
- data/app/models/ddr/batch/ingest_batch_object.rb +3 -3
- data/app/services/ddr/batch/monitor_batch_finished.rb +2 -4
- data/app/services/ddr/batch/monitor_batch_started.rb +1 -0
- data/db/migrate/20171116183514_add_collection_columns_to_batch.rb +8 -0
- data/lib/ddr/batch/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b669a1b89bbb629092cf71f8f4618d0a17dae0e0
|
4
|
+
data.tar.gz: 46f1292e988fb407dd28ead7a3ab52fa8772ddf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68302d269a1a68c359be955cc28654af8d975b0c2562b5d6a3c6dd21da119307ef8666e8137e8db400fb1015a6f6fa8dd9cceffeba6d7f6fd202f474bab8833
|
7
|
+
data.tar.gz: bddd38e9a212a44110ebad531b01dec844b7a0d322fccadd02915c1b6f43cb92c64bef47892610776ca404cf9cf67ac99aab74e8c78c3e965ea7820709f6be0f
|
@@ -5,15 +5,32 @@ module Ddr::Batch
|
|
5
5
|
def send_notification(batch)
|
6
6
|
@batch = batch
|
7
7
|
@title = "Batch Processor Run #{@batch.status} #{@batch.outcome}"
|
8
|
+
@title << " - #{@batch.collection_title}" if @batch.collection_title.present?
|
8
9
|
@host = `uname -n`.strip
|
9
10
|
@subject = "[#{@host}] #{@title}"
|
10
11
|
@size = @batch.batch_objects.size
|
11
12
|
@handled = @batch.handled_count
|
12
13
|
@success = @batch.success_count
|
13
|
-
attachments[
|
14
|
+
attachments[attachment_file_name(@batch)] = File.read(@batch.logfile.path)
|
14
15
|
mail(to: @batch.user.email, subject: @subject)
|
15
16
|
end
|
16
17
|
|
18
|
+
private
|
19
|
+
|
20
|
+
def attachment_file_name(batch)
|
21
|
+
if batch.collection_title.present?
|
22
|
+
sanitized_title = sanitize_title_for_filename(batch.collection_title)
|
23
|
+
"details_#{sanitized_title}.txt"
|
24
|
+
else
|
25
|
+
"details.txt"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def sanitize_title_for_filename(title)
|
30
|
+
title
|
31
|
+
.gsub(/[^\w\s_-]+/, '')
|
32
|
+
.gsub(/\s+/, '_')
|
33
|
+
end
|
17
34
|
end
|
18
35
|
|
19
36
|
end
|
@@ -47,7 +47,7 @@ module Ddr::Batch
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def ingest(user, opts = {})
|
50
|
-
repo_object = create_repository_object
|
50
|
+
repo_object = create_repository_object(user)
|
51
51
|
if !repo_object.nil? && !repo_object.new_record?
|
52
52
|
ingest_outcome_detail = []
|
53
53
|
ingest_outcome_detail << "Ingested #{model} #{identifier} into #{repo_object.pid}"
|
@@ -90,14 +90,14 @@ module Ddr::Batch
|
|
90
90
|
repo_object
|
91
91
|
end
|
92
92
|
|
93
|
-
def create_repository_object
|
93
|
+
def create_repository_object(user)
|
94
94
|
repo_pid = pid if pid.present?
|
95
95
|
repo_object = nil
|
96
96
|
begin
|
97
97
|
repo_object = model.constantize.new(:pid => repo_pid)
|
98
98
|
repo_object.label = label if label
|
99
99
|
batch_object_attributes.each { |a| repo_object = add_attribute(repo_object, a) }
|
100
|
-
repo_object.save(validate: false, skip_structure_updates: true)
|
100
|
+
repo_object.save(validate: false, skip_structure_updates: true, user: user)
|
101
101
|
batch_object_datastreams.each { |d| repo_object = populate_datastream(repo_object, d) }
|
102
102
|
batch_object_relationships.each { |r| repo_object = add_relationship(repo_object, r) }
|
103
103
|
batch_object_roles.each { |r| repo_object = add_role(repo_object, r) }
|
@@ -40,7 +40,8 @@ module Ddr::Batch
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def track_result(results_tracker, batch_object)
|
43
|
-
type
|
43
|
+
type = batch_object.type
|
44
|
+
model = batch_object.model || "Missing Model"
|
44
45
|
results_tracker[type] = Hash.new unless results_tracker.has_key?(type)
|
45
46
|
results_tracker[type][model] = Hash.new unless results_tracker[type].has_key?(model)
|
46
47
|
results_tracker[type][model][:successes] = 0 unless results_tracker[type][model].has_key?(:successes)
|
@@ -84,6 +85,3 @@ module Ddr::Batch
|
|
84
85
|
|
85
86
|
end
|
86
87
|
end
|
87
|
-
|
88
|
-
|
89
|
-
|
@@ -25,6 +25,7 @@ module Ddr::Batch
|
|
25
25
|
|
26
26
|
def log_batch_start(batch)
|
27
27
|
logger = Ddr::Batch::Log.logger(batch.id)
|
28
|
+
logger.info "Collection: #{batch.collection_title}" if batch.collection_title.present?
|
28
29
|
logger.info "Batch id: #{batch.id}"
|
29
30
|
logger.info "Batch name: #{batch.name}" if name
|
30
31
|
logger.info "Batch size: #{batch.batch_objects.size}"
|
data/lib/ddr/batch/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- db/migrate/20161115191636_add_columns_to_batch_object.rb
|
231
231
|
- db/migrate/20161116142512_create_batch_object_messages.rb
|
232
232
|
- db/migrate/20161222192611_remove_columns_from_batch.rb
|
233
|
+
- db/migrate/20171116183514_add_collection_columns_to_batch.rb
|
233
234
|
- lib/ddr-batch.rb
|
234
235
|
- lib/ddr/batch.rb
|
235
236
|
- lib/ddr/batch/batch_user.rb
|
@@ -251,9 +252,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
251
252
|
version: '0'
|
252
253
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
254
|
requirements:
|
254
|
-
- - "
|
255
|
+
- - ">"
|
255
256
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
257
|
+
version: 1.3.1
|
257
258
|
requirements: []
|
258
259
|
rubyforge_project:
|
259
260
|
rubygems_version: 2.6.11
|