Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Stop indexing the repository in the workflow indexer #420

Merged
merged 1 commit into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/indexers/workflow_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def to_solr
ProcessIndexer.new(solr_doc: solr_doc, workflow_name: workflow_name, process: process).to_solr
errors += 1 if process.status == 'error'
end
solr_doc.status = [workflow_name, workflow_status, errors, repository].join('|')
solr_doc.status = [workflow_name, workflow_status, errors].join('|')
end
end

private

attr_reader :workflow
delegate :workflow_name, :repository, to: :workflow
delegate :workflow_name, to: :workflow

def definition_process_names
@definition_process_names ||= begin
Expand Down
20 changes: 10 additions & 10 deletions spec/indexers/workflow_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
datetime="2012-11-06T16:18:24-0800" status="completed" name="start-accession"/>
<process version="2" elapsed="0.0" archived="true" attempts="1"
Expand All @@ -37,7 +37,7 @@
end

it 'creates the workflow_status field with the workflow repository included, and indicates that the workflow is still active' do
expect(solr_doc[Solrizer.solr_name('workflow_status', :symbol)].first).to eq('accessionWF|active|0|dor')
expect(solr_doc[Solrizer.solr_name('workflow_status', :symbol)].first).to eq('accessionWF|active|0')
end
end

Expand All @@ -49,7 +49,7 @@
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
datetime="2012-11-06T16:18:24-0800" status="completed" name="start-accession"/>
<process version="2" elapsed="0.0" archived="true" attempts="1"
Expand All @@ -59,15 +59,15 @@
end

it 'indicates that the workflow is complete' do
expect(solr_doc[Solrizer.solr_name('workflow_status', :symbol)].first).to eq('accessionWF|completed|0|dor')
expect(solr_doc[Solrizer.solr_name('workflow_status', :symbol)].first).to eq('accessionWF|completed|0')
end
end

context 'when all steps are completed or skipped' do
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" elapsed="0.0" archived="true" attempts="1"
datetime="2012-11-06T16:18:58-0800" status="skipped" name="hello"/>
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
Expand All @@ -81,15 +81,15 @@
end

it 'indexes the right workflow status (completed)' do
expect(solr_doc).to match a_hash_including('workflow_status_ssim' => ['accessionWF|completed|0|dor'])
expect(solr_doc).to match a_hash_including('workflow_status_ssim' => ['accessionWF|completed|0'])
end
end

context 'when the xml has dates for completed and errored steps' do
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" elapsed="0.0" archived="true" attempts="1"
datetime="2012-11-06T16:18:57-0800" status="error" name="hello"/>
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
Expand All @@ -112,7 +112,7 @@
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" elapsed="0.0" archived="true" attempts="1"
datetime="" status="error" name="hello"/>
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
Expand All @@ -137,7 +137,7 @@
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
datetime="2012-11-06T16:18:24-0800" status="completed" name="start-accession"/>
<process version="2" elapsed="0.0" archived="true" attempts="1"
Expand All @@ -159,7 +159,7 @@
let(:xml) do
<<-XML
<?xml version="1.0" encoding="UTF-8"?>
<workflow repository="dor" objectId="druid:gv054hp4128" id="accessionWF">
<workflow objectId="druid:gv054hp4128" id="accessionWF">
<process version="2" lifecycle="submitted" elapsed="0.0" archived="true" attempts="1"
datetime="2012-11-06T16:18:24-0800" status="completed" name="start-accession"/>
<process version="2" elapsed="0.0" archived="true" attempts="1"
Expand Down
12 changes: 6 additions & 6 deletions spec/indexers/workflows_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let(:xml) do
<<~XML
<workflows objectId="druid:ab123cd4567">
<workflow repository="dor" objectId="druid:ab123cd4567" id="accessionWF">
<workflow objectId="druid:ab123cd4567" id="accessionWF">
<process version="1" priority="0" note="" lifecycle="submitted" laneId="default" elapsed="" attempts="0" datetime="2019-01-28T20:41:12+00:00" status="completed" name="start-accession"/>
<process version="1" priority="0" note="common-accessioning-stage-a.stanford.edu" lifecycle="described" laneId="default" elapsed="0.258" attempts="0" datetime="2019-01-28T20:41:12+00:00" status="completed" name="descriptive-metadata"/>
<process version="1" priority="0" note="common-accessioning-stage-b.stanford.edu" lifecycle="" laneId="default" elapsed="0.188" attempts="0" datetime="2019-01-28T20:41:12+00:00" status="completed" name="rights-metadata"/>
Expand All @@ -27,7 +27,7 @@
<process version="1" priority="0" note="common-accessioning-stage-b.stanford.edu" lifecycle="" laneId="default" elapsed="0.246" attempts="0" datetime="2019-01-28T20:41:12+00:00" status="completed" name="reset-workspace"/>
<process version="1" priority="0" note="common-accessioning-stage-a.stanford.edu" lifecycle="accessioned" laneId="default" elapsed="1.196" attempts="0" datetime="2019-01-28T20:41:12+00:00" status="completed" name="end-accession"/>
</workflow>
<workflow repository="dor" objectId="druid:ab123cd4567" id="assemblyWF">
<workflow objectId="druid:ab123cd4567" id="assemblyWF">
<process version="1" priority="0" note="" lifecycle="pipelined" laneId="default" elapsed="" attempts="0" datetime="2019-01-28T20:40:18+00:00" status="completed" name="start-assembly"/>
<process version="1" priority="0" note="" lifecycle="" laneId="default" elapsed="" attempts="0" datetime="2019-01-28T20:40:18+00:00" status="skipped" name="jp2-create"/>
<process version="1" priority="0" note="sul-robots1-test.stanford.edu" lifecycle="" laneId="default" elapsed="0.25" attempts="0" datetime="2019-01-28T20:40:18+00:00" status="completed" name="checksum-compute"/>
Expand All @@ -40,10 +40,10 @@
<process version="2" priority="0" note="" lifecycle="" laneId="default" elapsed="0.0" attempts="0" datetime="2019-01-29T22:51:09+00:00" status="queued" name="exif-collect"/>
<process version="2" priority="0" note="" lifecycle="" laneId="default" elapsed="0.0" attempts="0" datetime="2019-01-29T22:51:09+00:00" status="queued" name="accessioning-initiate"/>
</workflow>
<workflow repository="dor" objectId="druid:ab123cd4567" id="disseminationWF">
<workflow objectId="druid:ab123cd4567" id="disseminationWF">
<process version="1" priority="0" note="common-accessioning-stage-b.stanford.edu" lifecycle="" laneId="default" elapsed="0.826" attempts="0" datetime="2019-01-28T20:46:57+00:00" status="completed" name="cleanup"/>
</workflow>
<workflow repository="dor" objectId="druid:ab123cd4567" id="hydrusAssemblyWF">
<workflow objectId="druid:ab123cd4567" id="hydrusAssemblyWF">
<process version="1" priority="0" note="" lifecycle="registered" laneId="default" elapsed="" attempts="0" datetime="2019-01-28T20:37:43+00:00" status="completed" name="start-deposit"/>
<process version="1" priority="0" note="" lifecycle="" laneId="default" elapsed="0.0" attempts="0" datetime="2019-01-28T20:37:43+00:00" status="completed" name="submit"/>
<process version="1" priority="0" note="" lifecycle="" laneId="default" elapsed="0.0" attempts="0" datetime="2019-01-28T20:37:43+00:00" status="completed" name="approve"/>
Expand All @@ -52,7 +52,7 @@
<process version="2" priority="0" note="" lifecycle="" laneId="default" elapsed="0.0" attempts="0" datetime="2019-01-28T20:48:17+00:00" status="completed" name="approve"/>
<process version="2" priority="0" note="" lifecycle="" laneId="default" elapsed="0.0" attempts="0" datetime="2019-01-28T20:48:18+00:00" status="completed" name="start-assembly"/>
</workflow>
<workflow repository="dor" objectId="druid:ab123cd4567" id="versioningWF">
<workflow objectId="druid:ab123cd4567" id="versioningWF">
<process version="2" priority="0" note="" lifecycle="opened" laneId="default" elapsed="" attempts="0" datetime="2019-01-28T20:48:16+00:00" status="completed" name="start-version"/>
<process version="2" priority="0" note="" lifecycle="" laneId="default" elapsed="" attempts="1" datetime="2019-01-28T20:48:16+00:00" status="completed" name="submit-version"/>
<process version="2" priority="0" note="" lifecycle="" laneId="default" elapsed="" attempts="1" datetime="2019-01-28T20:48:16+00:00" status="completed" name="start-accession"/>
Expand Down Expand Up @@ -132,7 +132,7 @@
describe 'workflow_status_ssim' do
subject { solr_doc['workflow_status_ssim'] }

it { is_expected.to eq ['accessionWF|completed|0|dor', 'assemblyWF|active|1|dor', 'disseminationWF|completed|0|dor', 'hydrusAssemblyWF|completed|0|dor', 'versioningWF|completed|0|dor'] }
it { is_expected.to eq ['accessionWF|completed|0', 'assemblyWF|active|1', 'disseminationWF|completed|0', 'hydrusAssemblyWF|completed|0', 'versioningWF|completed|0'] }
end
end
end