cul_hydra 1.0.6 → 1.0.7

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
  SHA1:
3
- metadata.gz: b2394e77a1eb550f0a7345256e447bf195ecf191
4
- data.tar.gz: d2283027faf5a423ff68c2971b71a65e6c0fceb6
3
+ metadata.gz: 01f266d6762f6bf8a2ce0d8c498a2fa414ac775d
4
+ data.tar.gz: b307b9f693f468d48c3b503332b9df090428cf40
5
5
  SHA512:
6
- metadata.gz: 82937f824a67b93f93ab736899f30dda395ede7288436d0478ec59870289d44cd5a530361685ac1e54671ce6a9d8967cb2823cfcb53a49f308fc8924bcc27f6e
7
- data.tar.gz: ab7a330d7a7ff0f32588a6aaf76a3363cd26ca2e6ab5e28ad900bcf65d4ce039d8bdc11f3c7220565b287625e7a6c010b439e67f9173a913f26ad9d6aa86e080
6
+ metadata.gz: 9a7d2446ef89b32a22d2e14945fb104fff5be8c1cd12562ab7e128fa90c5e09708c72a0a9d198ac37fa8b833f21cd8e972f383a267614de38b8337de5e5c5d6a
7
+ data.tar.gz: 3a1a0fb360f335f9138abbc0827b0339347023405980536002515ddfcf4496c4866d2eddef81eee782e03b6151c515e77e04cff13c4c48b30d4e34cb3e634f5b
@@ -156,7 +156,9 @@ class StructMetadata < ::ActiveFedora::Datastream
156
156
  current = node
157
157
  labels = []
158
158
  while (current.name == 'div')
159
- labels.unshift URI.escape(current['LABEL'])
159
+ label = URI.escape(current['LABEL'])
160
+ label = URI.escape(current['ORDER']) if label.blank?
161
+ labels.unshift label
160
162
  current = current.parent
161
163
  end
162
164
  labels
@@ -0,0 +1,4 @@
1
+ <mets:structMap xmlns:mets="http://www.loc.gov/METS/">
2
+ <mets:div CONTENTIDS="apt://columbia.edu/columbia.jay/data/jjbw/01026/01026001.tif" ORDER="1" LABEL=""/>
3
+ <mets:div CONTENTIDS="apt://columbia.edu/columbia.jay/data/jjbw/01026/01026002.tif" ORDER="2" LABEL=""/>
4
+ </mets:structMap>
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.0.6'
3
+ VERSION = '1.0.7'
4
4
  def self.version
5
5
  VERSION
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.0.5'
3
+ VERSION = '1.0.6'
4
4
  def self.version
5
5
  VERSION
6
6
  end
data/lib/tasks/index.rake CHANGED
@@ -1,3 +1,5 @@
1
+ require 'thread/pool'
2
+
1
3
  namespace :cul_hydra do
2
4
 
3
5
  namespace :index do
@@ -51,21 +53,58 @@ namespace :cul_hydra do
51
53
  puts 'Please specify a project PID (e.g. PID=cul:123)'
52
54
  next
53
55
  end
56
+
57
+ if ENV['THREADS'].present?
58
+ thread_pool_size = ENV['THREADS'].to_i
59
+ puts "Number of threads: #{thread_pool_size}"
60
+ else
61
+ thread_pool_size = 1
62
+ puts "Number of threads: #{thread_pool_size}"
63
+ end
54
64
 
55
65
  skip_generic_resources = (ENV['skip_generic_resources'] == 'true')
66
+
67
+ ### Stop excessive ActiveFedora logging ###
68
+ # initialize the fedora connection if necessary
69
+ connection = (ActiveFedora::Base.fedora_connection[0] ||= ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials)).connection
70
+ # the logger accessor is private
71
+ (connection.api.send :logger).level = Logger::INFO
56
72
 
57
73
  start_time = Time.now
58
74
  pids = Cul::Hydra::RisearchMembers.get_project_constituent_pids(project_pid, true)
59
75
  total = pids.length
60
76
  puts "Found #{total} project members."
61
77
  counter = 0
78
+
79
+ # We run into autoloading issues when running in a multithreaded context,
80
+ # so we'll have the application eager load all classes now.
81
+ Rails.application.eager_load!
82
+ # Hack: Force load of classes that are giving autoload errors by referencing them below
83
+ BagAggregator.to_s
84
+ ContentAggregator.to_s
85
+ GenericResource.to_s
86
+
87
+ ###########################################
88
+ pool = Thread.pool(thread_pool_size)
89
+ mutex = Mutex.new
62
90
 
63
91
  pids.each do |pid|
64
- Cul::Hydra::Indexer.index_pid(pid, skip_generic_resources, false)
65
- counter += 1
66
- puts "Indexed #{counter} of #{total} | #{Time.now - start_time} seconds"
92
+ pool.process {
93
+
94
+ Cul::Hydra::Indexer.index_pid(pid, skip_generic_resources, false)
95
+
96
+ mutex.synchronize do
97
+ counter += 1
98
+ puts "Indexed #{counter} of #{total} | #{Time.now - start_time} seconds"
99
+ end
100
+ }
67
101
  end
68
102
 
103
+ pool.shutdown
104
+ ###########################################
105
+
106
+ puts 'Done'
107
+
69
108
  end
70
109
 
71
110
  task :by_publish_target_pid => :environment do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul_hydra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-26 00:00:00.000000000 Z
12
+ date: 2015-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -137,6 +137,20 @@ dependencies:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: thread
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :runtime
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
140
154
  - !ruby/object:Gem::Dependency
141
155
  name: rdf
142
156
  requirement: !ruby/object:Gem::Requirement
@@ -432,6 +446,7 @@ files:
432
446
  - fixtures/spec/STRUCTMAP/structmap-nested.xml
433
447
  - fixtures/spec/STRUCTMAP/structmap-recto.xml
434
448
  - fixtures/spec/STRUCTMAP/structmap-seq.xml
449
+ - fixtures/spec/STRUCTMAP/structmap-unlabeled-seq.xml
435
450
  - fixtures/spec/STRUCTMAP/structmap-unordered-seq.xml
436
451
  - lib/cul_hydra.rb
437
452
  - lib/cul_hydra/access_controls_enforcement.rb