Skip to content

Commit 8295152

Browse files
committed
Cleaned up some log messages.
1 parent e42b938 commit 8295152

3 files changed

Lines changed: 12 additions & 24 deletions

File tree

lib/boutiques_bids_single_subject_maker.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,11 @@ def setup
283283
ds_file_id = self.invoke_params[ds_input.id]
284284
userfile = Userfile.find(ds_file_id)
285285

286-
basename = Revision_info.basename
287-
commit = Revision_info.short_commit
288-
self.addlog("#{basename} rev. #{commit}")
289-
290286
if userfile.is_a?(BidsDataset)
291-
self.addlog "BoutiquesBidsSingleSubject: preparing task for a BidsDataset"
287+
self.addlog "Preparing task for a BidsDataset"
292288
setup_for_bids_dataset()
293289
elsif userfile.is_a?(BidsSubject)
294-
self.addlog "BoutiquesBidsSingleSubject: preparing task for a BidsSubject"
290+
self.addlog "Preparing task for a BidsSubject"
295291
setup_for_bids_subject()
296292
else
297293
cb_error "This task was given a CBRAIN file of unknown type: #{userfile.class} ##{userfile.id}"
@@ -315,14 +311,14 @@ def setup_for_bids_subject #:nodoc:
315311
subject_name = userfile.name # 'sub-1234'
316312

317313
if ! File.directory?(FakeBidsDirName)
318-
self.addlog("BoutiquesBidsSingleSubject: Creating fake BIDS dataset '#{FakeBidsDirName}'")
314+
self.addlog("Creating fake BIDS dataset '#{FakeBidsDirName}'")
319315
Dir.mkdir(FakeBidsDirName)
320316
end
321317

322318
# Make a copy of the subject data
323319
copy_loc = Pathname.new(FakeBidsDirName) + subject_name
324320
verb = File.exists?(copy_loc.to_s) ? "Updating" : "Copying" # helps identifying what happens when restarting
325-
self.addlog("BoutiquesBidsSingleSubject: #{verb} subject data '#{subject_name}'")
321+
self.addlog("#{verb} subject data '#{subject_name}'")
326322
rsyncout = ssm_bash_this("rsync -a -l --no-g --chmod=u=rwX,g=rX,Dg+s,o=r --delete #{subject_name.bash_escape}/ #{copy_loc.to_s.bash_escape}")
327323
cb_error "Failed to rsync '#{subject_name}';\nrsync reported: #{rsyncout}" unless rsyncout.blank?
328324

@@ -333,14 +329,14 @@ def setup_for_bids_subject #:nodoc:
333329

334330
# Create dataset_description.json
335331
if ! File.exists?(desc_json_path)
336-
self.addlog("BoutiquesBidsSingleSubject: installing dataset_description.json")
332+
self.addlog("Installing dataset_description.json")
337333
File.open(desc_json_path,"w") { |fh| fh.write read_or_make_dataset_description(FakeBidsDirName) }
338334
end
339335

340336
# Create participants.tsv
341337
tsv_header, tsv_record = read_or_make_tsv_for_subject(subject_name)
342338
if ! File.exists?(participants_tsv_path)
343-
self.addlog "BoutiquesBidsSingleSubject: Creating new participants.tsv file for subject #{subject_name}"
339+
self.addlog "Creating new participants.tsv file for subject #{subject_name}"
344340
File.open(participants_tsv_path,"w") { |fh| fh.write "#{tsv_header}\n#{tsv_record}\n" }
345341
else
346342
# Append to existing participants.tsv.
@@ -349,15 +345,15 @@ def setup_for_bids_subject #:nodoc:
349345
tsv_content = File.read(participants_tsv_path).split("\n")
350346
# This code will break if several processes are all trying to do this at the exact same time.
351347
if ! tsv_content.any? { |line| line.sub(/[\s,].*/,"") == subject_name }
352-
self.addlog "BoutiquesBidsSingleSubject: Appending record for #{subject_name} to participants.tsv"
348+
self.addlog "Appending record for #{subject_name} to participants.tsv"
353349
File.open(participants_tsv_path,"a") { |fh| fh.write "#{tsv_record}\n" }
354350
end
355351
end
356352

357353
# Create optional .bidsignore file if any
358354
bidsignore_content = read_bidsignore_file()
359355
if ! File.exists?(ign_path) && bidsignore_content.present?
360-
self.addlog("BoutiquesBidsSingleSubject: installing .bidsignore file")
356+
self.addlog("Installing .bidsignore file")
361357
File.open(ign_path,"w") { |fh| fh.write bidsignore_content }
362358
end
363359

@@ -376,7 +372,7 @@ def read_or_make_tsv_for_subject(subject_name) #:nodoc:
376372
# In the case there is no specific participants.tsv file provided
377373
# in input, we return the info to create a simple one.
378374
if tsv_input_file_id.blank?
379-
self.addlog "BoutiquesBidsSingleSubject: participants.tsv file will contain only the subject name"
375+
self.addlog "participants.tsv file will contain only the subject name"
380376
return [ "participant_id", subject_name ] # TSV contains only participant ID
381377
end
382378

@@ -388,9 +384,9 @@ def read_or_make_tsv_for_subject(subject_name) #:nodoc:
388384
tsv_header = tsv_content[0].presence || "participant_id"
389385
tsv_record = tsv_content.detect { |line| line.sub(/[\s,].*/,"") == subject_name }
390386
if tsv_record.present?
391-
self.addlog "BoutiquesBidsSingleSubject: participants.tsv record for #{subject_name} extracted from supplied file"
387+
self.addlog "participants.tsv record for #{subject_name} extracted from supplied file"
392388
else
393-
self.addlog "BoutiquesBidsSingleSubject: Warning: no record for #{subject_name} found in participants.tsv file"
389+
self.addlog "Warning: no record for #{subject_name} found in participants.tsv file"
394390
tsv_record = subject_name
395391
end
396392
[ tsv_header, tsv_record ]

lib/boutiques_bids_subject_file_selector.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ def descriptor_for_final_task_list #:nodoc:
133133
# If cleaning need to be done the subject will be copied,
134134
# then the extra files will be removed.
135135
def setup #:nodoc:
136-
basename = Revision_info.basename
137-
commit = Revision_info.short_commit
138-
139136
self.addlog("Cleaning BIDS Subjects")
140-
self.addlog("#{basename} rev. #{commit}")
141137

142138
descriptor = self.descriptor_for_setup
143139
map_ids_for_bbss = descriptor.custom_module_info('BoutiquesBidsSubjectFileSelector') || {}

lib/boutiques_bids_subject_subsetter.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,7 @@ def descriptor_for_final_task_list #:nodoc:
138138
# If cleaning need to be done the subject will be copied,
139139
# then the extra files will be removed.
140140
def setup #:nodoc:
141-
basename = Revision_info.basename
142-
commit = Revision_info.short_commit
143-
144141
self.addlog("Cleaning BIDS dataset")
145-
self.addlog("#{basename} rev. #{commit}")
146142

147143
descriptor = self.descriptor_for_setup
148144
map_ids_for_bbss = descriptor.custom_module_info('BoutiquesBidsSubjectSubsetter') || {}
@@ -295,7 +291,7 @@ def remove_extra_files(subject_name,files_to_exclude_by_folder) #:nodoc:
295291
if removed_files.blank?
296292
self.addlog("Warning: no files removed based on filter specifications")
297293
else
298-
self.addlog("Remove files from #{subject_name}:\n#{removed_files}")
294+
self.addlog("Removed files from #{subject_name}:\n#{removed_files}")
299295
end
300296
end
301297

0 commit comments

Comments
 (0)