NeuralEnsemble/cobrawap

Avoid using "|" character in naming profile variants

Opened this issue · 1 comments

During the recent EBRAINS Software Distribution (ESD) Hackathon in Heidelberg, a potential weakness of Cobrawap has been pointed out.

As well documented here, for a fixed profile of analysis, different variants can be used, differentiated by using the | character. E.g., for main configuration profile config_some_profile.yaml, we could have two different variants:

  • config_some_profile|variant_1.yaml

  • config_some_profile|variant_2.yaml

Actually, the use of pipes in filenames can be a very likely pitfall, either for what regards filename parsing by external libraries (see the case of neo package), and more in general for filesystem robustness and portability. Also, many expert users may be used to manipulate files through the shell, and having |'s in filenames requires extra efforts for avoiding the interpretation of | as a "concatenate" command.

A possible solution for variants can be the already implemented use of the _ hierarchy in profile naming. So in the example above, the two variants would be:

  • config_some_profile_variant_1.yaml

  • config_some_profile_variant_2.yaml

which already have higher priority with respect to config_some_profile.yaml (exactly as it used to be before).

To note, the | has a functionality different from the _ in the profiling hierarchy:

# search order:
    config_some_profile_name|variant.yaml
    config_some_profile|variant.yaml
    config_some|variant.yaml
    config|variant.yaml
    config_some_profile_name.yaml
    config_some_profile.yaml
    config_some.yaml
    config.yaml

The crux is to choose a character that may not already be used in the path, and because _ has already another function I landed on |. In the pipeline, filenames are automatically quoted to not get in trouble with the bash meaning of characters.
However, let's discuss about a more elegant solution.