Skip to content

Commit

Permalink
tweaked upgrade tasks
Browse files Browse the repository at this point in the history
only triggers rdf generate jobs if repository configured, otherwise just clears cache, and only does so on the first run

for sample type policy updates, putc a . so progress can be seen rather than appearing frozen for large databases
  • Loading branch information
stuzart committed Nov 14, 2024
1 parent 236936e commit 916302c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/tasks/seek_upgrades.rake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace :seek do
task upgrade_version_tasks: %i[
environment
db:seed:007_sample_attribute_types
seek_rdf:generate
update_rdf
update_observation_unit_policies
fix_xlsx_marked_as_zip
add_policies_to_existing_sample_types
Expand Down Expand Up @@ -47,6 +47,22 @@ namespace :seek do
end
end

# if rdf repository enabled then generate jobs, otherwise just clear the cache. Only runs once
task(update_rdf: [:environment]) do
only_once('seek:update_rdf 1.16.0') do
if Seek::Rdf::RdfRepository.instance&.configured?
puts '... triggering rdf generation jobs'
Rake::Task['seek_rdf:generate'].invoke
else
path = Seek::Config.rdf_filestore_path
unless Dir.empty?(path)
puts "... clearing rdf cache at #{path}"
FileUtils.rm_rf(path, secure: true)
end
end
end
end

task(update_observation_unit_policies: [:environment]) do
puts '..... creating observation unit policies ...'
affected_obs_units = []
Expand Down Expand Up @@ -104,7 +120,8 @@ namespace :seek do

policy.save
st.update_column(:policy_id, policy.id)
end
end
putc('.')
counter += 1
end
end
Expand Down

0 comments on commit 916302c

Please sign in to comment.