Skip to content
Snippets Groups Projects
Commit 43cbfa6e authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Merge branch 'bug_fix/341_rake_task_for_meta_json' into 'develop'

Modified rake task to save metadata in S3

Closes FDM/rdm-system/antleaf-projectmanagement#341

See merge request !284
parents c3e6182e 57919b24
Branches
Tags
1 merge request!284Modified rake task to save metadata in S3
Pipeline #13246 failed
......@@ -2,16 +2,35 @@
namespace :rdms do
desc "Fix metadata in S3 for all works. usage: rdms:fix_metadata_in_s3"
task fix_metadata_in_s3: :environment do
puts "Fixing Dataset"
all_works = %w(Dataset CrcDataset ComplexSubjecr ComplexSession ComplexModality)
all_works = %w(Dataset CrcDataset ComplexSubject ComplexSession ComplexModality)
all_works.each do |work_type|
work_type.constantize.all.each do |w|
begin
w.save
rescue
puts "Error saving #{w.id}"
# Save the metadata.json file along with system_metadata.json
puts "Saving metadata for #{work_type} #{w.id}"
case work_type
when 'Dataset', 'CrcDataset'
begin
w.save_work_meta_json_file_to_s3
rescue
puts "error saving metadata for #{work_type} #{w.id}"
end
else
begin
w.send(:save_work_meta_json_file_to_s3)
rescue
puts "error saving metadata for #{work_type} #{w.id}"
end
end
if work_type == "CrcDataset"
# save meta.json for modalities
puts "Saving meta.json for #{work_type} #{w.id}"
begin
w.handle_meta_file_on_s3
rescue
puts "error saving metadata for #{work_type} #{w.id}"
end
end
end
end
end
end
\ No newline at end of file
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment