Due to the issue described here where input files with the same basename cause errors with a directory InitialWorkDirRequirement, I need to find a way to generate unique filenames that will not conflict with each other.
Ideally, I would just use a Javascript expression inside my CWL to accomplish this, but I could not get any of these suggested methods to generate random strings to work (or they required huge amounts of custom code too large to easily use across many CWL’s).
I did come up with one solution that uses Python’s uuid library;
This works, but has limitations / annoyances in that it messes up the input bindings for the other CLI args I might want to use, and it relies on having Python available which might not be the case.
Is there a way to do something like this directly within CWL?
At the very least, I would like to avoid needing to use the InitialWorkDirRequirement, and I was hoping there was a method where I could use a shell expression, like this;
Backing up a step, each input file will have a unique path (just not a unique name), what’s the reason you want to put them all into the working directory and not refer to them as regular input files?
something I had considered was instead of copying the files into the staging dir like this;
InitialWorkDirRequirement:
listing:
- entryname: some_dir # <- put all the input files into a dir
writable: true
entry: "$({class: 'Directory', listing: inputs.input_files})"
was to instead copy the files’ entire directory tree into the dir, which would include the unique filepath component that would avoid name conflicts. However, I couldnt figure out how to accomplish that.