Skip to content

Commit e6815f3

Browse files
Add more methods to document cbrain custom properties #1128
1 parent 9fa60bb commit e6815f3

File tree

1 file changed

+104
-14
lines changed

1 file changed

+104
-14
lines changed

BrainPortal/lib/boutiques_support.rb

Lines changed: 104 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,30 +289,120 @@ def file_revision_info
289289
# as walltime added to Boutiques resources sections
290290
#
291291

292-
# Return strings with name(s) and emails(s) of the Boutiques descriptor authors. Emails are optional
292+
# Returns a string with name(s) and emails(s) of the Boutiques descriptor authors, enlisted in
293+
# "cbrain:author" custom property of the descriptors. Emails are optional
293294
# and should be in angle brackets
294295
#
295-
# For example
296+
# For example, given the descriptor with
296297
# "custom": { "cbrain:author": "Full Name <[email protected]>, Co-author Name <[email protected]>" }
297-
#
298+
# The method returns string
299+
# "Full Name <[email protected]>, Co-author Name <[email protected]>"
298300
def author_custom
299301
authors = self.custom['cbrain:author']
300302
return authors if authors is_a? String
301-
return authors.join(", ") # if author field is arrays
303+
return authors.join(", ") # if author field is arrays
302304
end
303305

304-
# Return strings with name(s) and emails(s) of the Boutiques descriptor authors. Emails are optional
305-
# and should be in angle brackets
306-
#
307-
# For example
308-
# "custom": { "cbrain:author": "Full Name <[email protected]>, Co-author Name <[email protected]>" }
309-
#
310-
def author_custom
311-
authors = self.custom['cbain:author']
312-
return authors if authors is_a? String
313-
return authors.join(", ") # if author field is arrays
306+
# Returns Boutiques CBRAIN custom property indicating
307+
# are forking sub-task(s) allowed. To submit a subtask, a task must create a JSON file
308+
# named ".new-task-*.json" at the root of its
309+
# work directory
310+
# An example of property definition in a tool descriptor:
311+
# "custom: {
312+
# "cbrain:can-submit-new-tasks": true
313+
# }
314+
def can_submit_new_tasks_custom
315+
return self.custom["cbrain:can-submit-new-tasks"]
316+
end
317+
318+
# Returns Boutiques CBRAIN custom property indicating
319+
# the outputs which will not be saved.
320+
# An example of property definition in a tool descriptor:
321+
# "custom: {
322+
# "cbrain:ignore_outputs": [output_id_1, output_id_2, output_id_3 ... ]
323+
# }
324+
def ignore_outputs_custom
325+
return self.custom["cbrain:ignore_outputs"]
326+
end
327+
328+
# Returns Boutiques CBRAIN custom property indicating
329+
# inputs which are saved back to the dataprovider (the original data will be mutated)
330+
# An example of property definition in a tool descriptor:
331+
# "custom: {
332+
# "cbrain:save_back_inputs": [id_1, id_2, id_3 ...]
333+
# }
334+
def save_back_inputs_custom
335+
return self.custom["cbrain:save_back_inputs"]
314336
end
315337

338+
# Returns Boutiques CBRAIN custom property indicating
339+
# if the tool cannot modify inputs
340+
# An example of property definition in a tool descriptor:
341+
# "custom: {
342+
# "cbrain:readonly-input-files": true
343+
# }
344+
def readonly_input_files_custom
345+
return self.custom["cbrain:readonly-input-files"]
346+
end
347+
348+
# Returns Boutiques CBRAIN custom property indicating
349+
# if this task may alter its input files
350+
# An example of property definition in a tool descriptor:
351+
# "custom: {
352+
# "cbrain:alters-input-files": true
353+
# }
354+
def alters_input_files_custom
355+
return self.custom["cbrain:alters-input-files"]
356+
end
357+
358+
# Returns Boutiques CBRAIN custom property indicating for which outputs
359+
# the usual practice of adding a run id to output file names is cancelled,
360+
# list of output IDs where no run id inserted. Only allowed for MultiLevel
361+
# data-providers with "browse path" capability.
362+
# For listed outputs ids new results overwrite old files.
363+
# An example of property definition in a tool descriptor:
364+
# "custom: {
365+
# "cbrain:no-run-id-for-outputs": "id_1, id_2, id_3 .."
366+
# }
367+
def no_run_id_for_outputs_custom
368+
return self.custom["cbrain:no-run-id-for-outputs"]
369+
end
370+
371+
# Returns Boutiques CBRAIN custom property indicating
372+
# for which inputs an empty string is a valid input
373+
# An example of property definition in a tool descriptor:
374+
# "custom: {
375+
# "cbrain:allow_empty_strings": [input_id]
376+
# }
377+
def allow_empty_strings_custom
378+
return self.custom["cbrain:allow_empty_strings"]
379+
end
380+
381+
# Experimental
382+
# The default implied value is 'simulate'
383+
# In the mode 'simulate', at the moment of creating
384+
# the tool's script in cluster_commands(), the
385+
# output of 'bosh exec simulate' will be substituted in
386+
# the script to generate the tool's command.
387+
# In the mode 'launch', an actual 'bosh exec launch' command
388+
# will be put in the script instead.
389+
# An example of property definition in a tool descriptor:
390+
# "custom: {
391+
# "cbrain:boutiques_bosh_exec_mode": "launch"
392+
# }
393+
def boutiques_bosh_exec_mode_custom
394+
return self.custom["cbrain:boutiques_bosh_exec_mode"]
395+
end
396+
397+
# An advanced feature for seasoned CBRAIN experts only. That allows
398+
# overwrite the standard task behavior with custom class
399+
# An example of property definition in a tool descriptor:
400+
# "custom: {
401+
# "cbrain:inherits-from-class": "MyClassName"
402+
# }
403+
def inherits_from_class_custom
404+
return self.custom["cbrain:inherits-from-class"]
405+
end
316406

317407
# Given a module name, returns the structure with the
318408
# data for it stored under the "custom"['cbrain:integrator_modules']

0 commit comments

Comments
 (0)