Skip to content

Commit

Permalink
Remove accession_items and related code
Browse files Browse the repository at this point in the history
Fixes #262
  • Loading branch information
atz committed Sep 21, 2018
1 parent 0874d63 commit d8ab664
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 78 deletions.
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,23 +604,13 @@ RAILS_ENV=production bundle exec bin/mods_report YAML_CONFIG_FILE OUTPUT_DIRECTO

## Accession of Specific Objects

For projects with a manifest (e.g. like Revs):
Using a manifest:

1. Create a new manifest with only the objects you need accessioned.
2. Create a new project config YAML file referencing the new manifest and
write to a new progress log file.
3. Run pre-assembly.

For projects that do not use a manifest (e.g. like Rumsey):

1. Create a new project config YAML file and set the parameter
`accession_items` using either the `only` or `except` parameter as needed.
You can include only specific objects (useful when you only want to run a few objects)
or you can exclude specific objects (useful when you want to run most).
Also set a different progress log file so you can store the results of
your second run separately. See the `TEMPLATE.yaml` for some examples.
1. Run pre-assembly.

## Re-Accession of Specific Objects

Very similar to above, if you need to re-accession a batch of material (for
Expand Down
16 changes: 2 additions & 14 deletions app/lib/pre_assembly/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class Bundle
:skippables,
:smpl_manifest

delegate :accession_items,
:apo_druid_id,
delegate :apo_druid_id,
:apply_tag,
:bundle_dir,
:config_filename,
Expand Down Expand Up @@ -255,18 +254,7 @@ def process_digital_objects
end

def objects_to_process
return @o2p if @o2p
@o2p = digital_objects.reject { |dobj| skippables.has_key?(dobj.unadjusted_container) }
return @o2p if accession_items.nil? # check to see if we are specifying certain objects to be accessioned
if accession_items[:only]
whitelist = accession_items[:only].map { |x| DruidTools::Druid.new(x).druid } # normalize
@o2p.select! { |dobj| whitelist.include?(dobj.druid.druid) }
end
if accession_items[:except]
blacklist = accession_items[:except].map { |x| DruidTools::Druid.new(x).druid } # normalize
@o2p.reject! { |dobj| blacklist.include?(dobj.druid.druid) }
end
@o2p
@o2p ||= digital_objects.reject { |dobj| skippables.has_key?(dobj.unadjusted_container) }
end

def log_progress_info(dobj)
Expand Down
8 changes: 1 addition & 7 deletions app/lib/pre_assembly/reporting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ def discovery_report(params = {})
puts "Object discovery via manifest, #{bundle_context.manifest}"
puts "Checking APO and registration status"
puts "Using SMPL manifest for contentMetadata: #{File.join(bundle_dir, content_md_creation[:smpl_manifest])}" if using_smpl_manifest

# TODO: are we going to support this option in the project yaml?
if accession_items
puts "You are processing specific objects only" if accession_items[:only]
puts "You are processing all discovered except for specific objects" if accession_items[:except]
end


header = "\nObject Container , Number of Items , Files with no ext, Files with 0 Size, Total Size, Files Readable , "
header += "Label , Source ID , "
header += "Num Files in CM Manifest , All CM files found ," if using_smpl_manifest
Expand Down
5 changes: 0 additions & 5 deletions app/models/bundle_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ def stageable_discovery
{}
end

# TODO: delete everywhere in code as single commit (#262)
def accession_items
nil
end

# TODO: Delete everywhere in code as single commit (#227)
def content_exclusion
nil
Expand Down
24 changes: 0 additions & 24 deletions spec/test_data/exemplar_templates/TEMPLATE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,6 @@ stageable_discovery:
# be ignored) -- this is useful to avoid duplication of staged files
# if set to false or left off, then anything that matches the glob (and not filtered by regex) will be staged

####
# Restrict objects to be accessioned when using the discovery method
####
accession_items: ~ # Only valid for projects that do *not* use a manifest.
# Used if you need to accession or re-accession only specific objects.
# You can supply a list of container names, and indicate if this list is exlcusionary
# or inclusionary. In other words, do you want to *only* accession the named items, or accession
# everything *except* those listed? You can also specify if this is a re-accession, in which case the
# items will be reset (but not unregistered from DOR) before accessioning again.
# If you specify ~, all items will be accessioned and you can leave off the "only" and "except" parameters.
# Note that you will probably also want to log this new run using a different progress log file.
# In the "only" and "except" list, you should use names that exactly match the folder names in your bundle_dir,
# one per line, indented under "only" or "except" and preceeded by a dash as shown in the examples below.
# For a normal run, set "accession_items" to ~, which will process all items.
# Do not specify both "only" and "except" unless you like flying experimental homebuilt aircraft.
# Examples below:
only:
- 'aa111aa1111'
- 'bb222bb2222' # this is an example of two objects that will be accessioned, put them one per line, prefixed by a space, a dash, and space, add quotes around each item
except:
- 'aa111aa1111'
- 'bb222bb2222' # this is an example of two objects that will be ignored, put them one per line, prefixed by a space, a dash, and space, add quotes around each item
# If set to true, the the files will be removed for /dor/assembly, /dor/workspace and the stacks before accessioning again. Objects will *not* be re-registered.

####
# Additional materials accompaning the bundle.
#
Expand Down
8 changes: 0 additions & 8 deletions spec/test_data/exemplar_templates/reg_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ project_style:
content_structure: 'simple_book'

bundle_dir: '/thumpers/dpgthumper-staging/Gould'
accession_items: ~

stageable_discovery:
glob: '00/*'
Expand All @@ -14,16 +13,9 @@ manifest: ~
checksums_file: ~
desc_md_template: ~

manifest_cols:
object_container: ~
source_id: ~
label: ~

project_name: 'Gould'

progress_log_file: '/dor/preassembly/gould_log.yaml'
apo_druid_id: ~
set_druid_id: ~

content_exclusion: ~

Expand Down
5 changes: 0 additions & 5 deletions spec/test_data/project_config_files/smpl_acc_except.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ project_style:

bundle_dir: 'spec/test_data/smpl_multimedia'

accession_items:
except:
- 'aa111aa1111'
- 'bb222bb2222'

content_md_creation:
style: 'smpl'

Expand Down
4 changes: 0 additions & 4 deletions spec/test_data/project_config_files/smpl_acc_only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ project_style:

bundle_dir: 'spec/test_data/smpl_multimedia'

accession_items:
only:
- 'aa111aa1111'

content_md_creation:
style: 'smpl'

Expand Down

0 comments on commit d8ab664

Please sign in to comment.