SlicerExecutionModel
SlicerExecutionModel copied to clipboard
Add support for Temporary directory
Discussion: http://slicer-devel.65872.n3.nabble.com/Temporary-directory-for-CLI-modules-td4035464.html
Reason to reject initial patch from @ prastawa : Patch Slicer/Slicer#400 will be problematic when the CLI is executed directly without Slicer.
Proposal:
- CLI should always expect the environment variable
SEM_TEMPORARY_DIRto be set SEM_TEMPORARY_DIRcan be set in three different ways:- Set by reading the value of an other environment variable. This other environment variable would be set configuring SlicerExecutionModel using for example
-DSEM_TEMPORARY_DIR_ENVVAR_NAME:STRING=SLICER_TEMPORARY_DIR - Set by reading the value of special parameter named
--sem-temporary-dir. If specified, other environment variable would be ignored - If neither (1) or (2) have been set, temporary directory will be set to the operating system default
- Set by reading the value of an other environment variable. This other environment variable would be set configuring SlicerExecutionModel using for example
- code in charge of reading the other environment variable, or special parameter would be embedded in the CLI thanks to code generated by
GenerateCLP
Cc: @Slicer/slicer-core
Sounds good to me. Just two suggestions:
- Instead of --sem-temporary-dir we could simply use --temporaryDir. We already reserve special argument names without using any prefix (e.g., we use --logo instead of --semLogo). I would use temporaryDir instead of temporary-dir to be consistent with other command-line argument names (- is not used because C variable names cannot contain -).
- Why do we pass the temporary dir to the CLI main() function as an env var? PARSE_ARGS could simply store the temporary directory as a string, for example temporaryDir. It would be more consistent with how other values that are specified as a command-line arguments are passed on the the main() function.
temporary dir to the CLI ... as a command-line arguments [...] using
--temporaryDir
Only using PARSE_ARGS makes sense and would greatly simplify the initial proposal. If not specified, a reasonable default would be selected. (Operating system one, or current directory if not available)
Why do we pass the temporary dir to the CLI main() function as an env var?
My initial proposal was broad enough to include all the idea previously discussed. Going with --temporaryDir makes sense to me.
+1, --temporaryDir sounds good to me