lyber-core 4.0.2 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lyber_core/robot.rb +7 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 670243ab111d6e63f1e7195e390c99729944df34
4
- data.tar.gz: f0c6571d5ca9c012adb8906b2543af5620d23af6
3
+ metadata.gz: 9fc34876430c8f4ffc5565b058178458e12055b1
4
+ data.tar.gz: e84c0b849c546a2df3904dea2b1f1f0bf6724fbf
5
5
  SHA512:
6
- metadata.gz: c51584eaaecba319cc1cd501e995cb80a40d08e51acd9bcaaec93342669157fa5e30896abaca1dd8534607fbbdf250d1429970d157306d149830781bd74de8f1
7
- data.tar.gz: 89c455101cea46011b301586b3b398edc2e6d67ae81541a823f48e450230ea919dcf075efd230c138c7e3abd154d0e58be96828ab0ce8345b53224651ea4a5c4
6
+ metadata.gz: e21ec8b110238fd7354efd5aa8e3fbec5f8fcb15f9e31c3e5a1a008cd702edfc415342c247e74a4eb2a55e035fbbc34b7249d8e33eafdeb74ef14993f4d1a2c2
7
+ data.tar.gz: b24ee5613f2cd41e2774110cae826e977cd8e712bd9ea690c28e2ff93963486566aa7fad899c268d10a3fb03e040039739b18865f220faaeb574b354a8528e00
@@ -46,6 +46,7 @@ module LyberCore
46
46
  end
47
47
 
48
48
  attr_accessor :check_queued_status
49
+ attr_reader :workflow_service
49
50
 
50
51
  def initialize(repo, workflow_name, step_name, opts = {})
51
52
  Signal.trap("QUIT") { puts "#{Process.pid} ignoring SIGQUIT" } # SIGQUIT ignored to let the robot finish
@@ -53,6 +54,7 @@ module LyberCore
53
54
  @workflow_name = workflow_name
54
55
  @step_name = step_name
55
56
  @check_queued_status = opts.fetch(:check_queued_status, true)
57
+ @workflow_service = opts.fetch(:workflow_service, Dor::WorkflowService)
56
58
  # create option to check return value of process_item
57
59
  # @check_if_processed = opts.fetch(:check_if_processed, false)
58
60
  end
@@ -72,21 +74,22 @@ module LyberCore
72
74
  # otherwise, the robot did something like set the step to 'waiting' with a note
73
75
 
74
76
  # update the workflow status from 'queued' to 'completed' -- errors out if current status is not queued
75
- Dor::WorkflowService.update_workflow_status @repo, druid, @workflow_name, @step_name, 'completed', :elapsed => elapsed, :note => Socket.gethostname, :current_status => 'queued'
77
+ workflow_service.update_workflow_status @repo, druid, @workflow_name, @step_name, 'completed', :elapsed => elapsed, :note => Socket.gethostname, :current_status => 'queued'
76
78
  LyberCore::Log.info "Finished #{druid} in #{sprintf("%0.4f",elapsed)}s"
77
79
  rescue => e
78
80
  begin
79
81
  LyberCore::Log.error e.message + "\n" + e.backtrace.join("\n")
80
- Dor::WorkflowService.update_workflow_error_status @repo, druid , @workflow_name, @step_name, e.message, :error_text => Socket.gethostname
82
+ workflow_service.update_workflow_error_status @repo, druid , @workflow_name, @step_name, e.message, :error_text => Socket.gethostname
81
83
  rescue => e2
82
84
  LyberCore::Log.error "Cannot set #{druid} to status='error'\n" + e2.message + "\n" + e2.backtrace.join("\n")
83
85
  raise e2 # send exception to Resque failed queue
84
86
  end
85
87
  end
86
88
 
87
- private
89
+ private
90
+
88
91
  def item_queued?(druid)
89
- status = Dor::WorkflowService.get_workflow_status(@repo, druid, @workflow_name, @step_name)
92
+ status = workflow_service.get_workflow_status(@repo, druid, @workflow_name, @step_name)
90
93
  if(status =~ /queued/i)
91
94
  return true
92
95
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lyber-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alpana Pande
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2016-02-25 00:00:00.000000000 Z
18
+ date: 2016-03-02 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: dor-workflow-service
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: 1.3.6
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.4.5.1
145
+ rubygems_version: 2.4.8
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Core services used by the SULAIR Digital Library