psychoinformatics-de / datalad-hirni

DataLad extension for (semi-)automated, reproducible processing of (medical/neuro)imaging data
http://datalad.org
Other
5 stars 8 forks source link

underscores in procedure name leads to call-format being ignored #177

Open pvavra opened 3 years ago

pvavra commented 3 years ago

Running hirni-spec2bids does not handle procedures with a underscores in their name correctly.

For example, naming a custom procedure converter_behavior.py and providing a custom procedure call via the specs will lead to environmental variable DATALAD_PROCEDURES_CONVERTER_BEHAVIOR_CALL__FORMAT being set.

However, the subsequent dataset.config.reload() wrongly interprets the underscore in the filename as a section leading to datalad.procedures.converter.behavior (note the dot between "converter" and "behavior").

Subsequently, the format-call does not get used in the execution of the procedure. Instead, a default format-call is used and no substitutions are happening.

Partial name-sanitization is already handled (for dashes) in the following lines, but does not account for underscores: https://github.com/psychoinformatics-de/datalad-hirni/blob/79b8209c5e3194336afe56f7cd6edceaab9cd994/datalad_hirni/commands/spec2bids.py#L246-L248

What made tracking this down difficult is that the procedure itself does get called, since it's passed on by name directly ( https://github.com/psychoinformatics-de/datalad-hirni/blob/79b8209c5e3194336afe56f7cd6edceaab9cd994/datalad_hirni/commands/spec2bids.py#L267).

Note that calling the procedure directly via datalad run-procedure convert_behavior .. with the appropriate input will work, so this is purely about how the call-format is handed over to datalad.run-procedure().

Occurs with datalad 0.14.0 & hirni 0.0.8

pvavra commented 3 years ago

as a simple workaround: remove the underscores in the procedure filename..

bpoldrack commented 3 years ago

True! Thanks for pointing that out. This needs proper documentation, there only is a code comment on that issue. I don't see a way to make underscores in the names work (same for underscores in the filed names of spec entries) ATM w/o major change to datalad-run/datalad run-procedure.

Note, however, that a dash instead of an underscore should work just fine.