Skip to content

Commit

Permalink
reformat a big json sample, custom first method names aces#1128
Browse files Browse the repository at this point in the history
  • Loading branch information
MontrealSergiy committed Mar 4, 2024
1 parent cdbdced commit ea15cd0
Showing 1 changed file with 38 additions and 32 deletions.
70 changes: 38 additions & 32 deletions BrainPortal/lib/boutiques_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def self.validate(json)
)
end

# The following assignement is pretty much like
# The following assignment is pretty much like
# class BoutiquesDescriptor < RestrictedHash
# except we have a closure and we can access the variables
# initialize above (top_prop_names etc).
Expand Down Expand Up @@ -284,30 +284,36 @@ def file_revision_info
# "custom" section of a Boutiques descriptor, to fine-tune the way CBRAIN
# interpret the descriptor. For example,
#
# "custom": {
# "custom": {
# "cbrain:readonly-input-files": true,
# "cbrain:author": "Erik Lee <[email protected]>",
# "cbrain:allow_empty_strings": ["derivatives_prefix"],
# "cbrain:no-run-id-for-outputs": [ "OutputDirectory"],
# "cbrain:allow_empty_strings": [
# "derivatives_prefix"
# ],
# "cbrain:no-run-id-for-outputs": [
# "OutputDirectory"
# ],
# "cbrain:integrator_modules": {
# "BoutiquesFileTypeVerifier": {
# "SubjectDirectory": [ "BidsSubject" ]
# },
# "BoutiquesFileNameMatcher": {
# "SubjectDirectory": "^sub-[a-zA-Z0-9_]+$"
# },
# "BoutiquesOutputFileTypeSetter": {
# "OutputDirectory": "MADEOutput"
# },
# "BoutiquesForcedOutputBrowsePath" : {
# "OutputDirectory": "[DERIVATIVES_PREFIX]made"
# },
# "BoutiquesBidsSingleSubjectMaker": "SubjectDirectory",
# "BoutiquesBidsSubjectFileSelector": {
# "SubjectDirectory": "all_to_keep"
# }
# "BoutiquesFileTypeVerifier": {
# "SubjectDirectory": [
# "BidsSubject"
# ]
# },
# "BoutiquesFileNameMatcher": {
# "SubjectDirectory": "^sub-[a-zA-Z0-9_]+$"
# },
# "BoutiquesOutputFileTypeSetter": {
# "OutputDirectory": "MADEOutput"
# },
# "BoutiquesForcedOutputBrowsePath": {
# "OutputDirectory": "[DERIVATIVES_PREFIX]made"
# },
# "BoutiquesBidsSingleSubjectMaker": "SubjectDirectory",
# "BoutiquesBidsSubjectFileSelector": {
# "SubjectDirectory": "all_to_keep"
# }
# }
# }
# }
#
# ---------------- Present List of Properties -----------------------------
#
Expand Down Expand Up @@ -368,7 +374,7 @@ def file_revision_info
#
# "cbrain:walltime-estimate": value_in_seconds
# Deprecated
# as walltime added to Boutiques resources sections
# since walltime was added to Boutiques resources sections
#
# The methods to retrieve the values related to cbrain custom properties are listed below

Expand All @@ -380,7 +386,7 @@ def file_revision_info
# "custom": { "cbrain:author": "Full Name <[email protected]>, Co-author Name <[email protected]>" }
# The method returns string
# "Full Name <[email protected]>, Co-author Name <[email protected]>"
def author_custom
def custom_author
authors = self.custom['cbrain:author']
return authors if authors is_a? String
return authors.join(", ") # if author field is arrays
Expand All @@ -394,7 +400,7 @@ def author_custom
# "custom: {
# "cbrain:can-submit-new-tasks": true
# }
def can_submit_new_tasks_custom
def custom_can_submit_new_tasks
return self.custom["cbrain:can-submit-new-tasks"]
end

Expand All @@ -404,7 +410,7 @@ def can_submit_new_tasks_custom
# "custom: {
# "cbrain:ignore_outputs": [output_id_1, output_id_2, output_id_3 ... ]
# }
def ignore_outputs_custom
def custom_ignore_outputs
return self.custom["cbrain:ignore_outputs"]
end

Expand All @@ -414,7 +420,7 @@ def ignore_outputs_custom
# "custom: {
# "cbrain:save_back_inputs": [id_1, id_2, id_3 ...]
# }
def save_back_inputs_custom
def custom_save_back_inputs
return self.custom["cbrain:save_back_inputs"]
end

Expand All @@ -424,7 +430,7 @@ def save_back_inputs_custom
# "custom: {
# "cbrain:readonly-input-files": true
# }
def readonly_input_files_custom
def custom_readonly_input_files
return self.custom["cbrain:readonly-input-files"]
end

Expand All @@ -434,7 +440,7 @@ def readonly_input_files_custom
# "custom: {
# "cbrain:alters-input-files": true
# }
def alters_input_files_custom
def custom_alters_input_files
return self.custom["cbrain:alters-input-files"]
end

Expand All @@ -447,7 +453,7 @@ def alters_input_files_custom
# "custom: {
# "cbrain:no-run-id-for-outputs": "id_1, id_2, id_3 .."
# }
def no_run_id_for_outputs_custom
def custom_no_run_id_for_outputs
return self.custom["cbrain:no-run-id-for-outputs"]
end

Expand All @@ -457,7 +463,7 @@ def no_run_id_for_outputs_custom
# "custom: {
# "cbrain:allow_empty_strings": [input_id]
# }
def allow_empty_strings_custom
def custom_allow_empty_strings
return self.custom["cbrain:allow_empty_strings"]
end

Expand All @@ -473,7 +479,7 @@ def allow_empty_strings_custom
# "custom: {
# "cbrain:boutiques_bosh_exec_mode": "launch"
# }
def boutiques_bosh_exec_mode_custom
def custom_boutiques_bosh_exec_mode
return self.custom["cbrain:boutiques_bosh_exec_mode"]
end

Expand All @@ -483,7 +489,7 @@ def boutiques_bosh_exec_mode_custom
# "custom: {
# "cbrain:inherits-from-class": "MyClassName"
# }
def inherits_from_class_custom
def custom_inherits_from_class
return self.custom["cbrain:inherits-from-class"]
end

Expand Down

0 comments on commit ea15cd0

Please sign in to comment.