vsoch / scif

scientific filesystem: a filesystem organization for scientific software and metadata
https://sci-f.github.io/
Mozilla Public License 2.0
30 stars 13 forks source link

Add environment to be sourced (inline with runscript) #32

Closed vsoch closed 6 years ago

vsoch commented 6 years ago

This will add the environment definition to be sourced at the start of the runscript, meaning that variables are defined and then run there (so if we have a situation where a variable is defined it will be properly sourced, eg.)

%appenv foo
   VARIABLE1=$VARIABLE2
    export VARIABLE2

In the case of having the python read this text and then set in the environment, we would have a hard time parsing what VARIABLE2 is We also want to be able to handle the user passing in custom variables at runtime, so instead we add these lines to the top of the runscript (during runtime), eg given this runscript

%apprun foo
   echo "HELLO!"
   echo $VARIABLE1

The final script would be:

   VARIABLE1=$VARIABLE2
   export VARIABLE2
   echo "HELLO!"
   echo $VARIABLE1

This seems like a reasonable solution for now - the others I considered are attempting substitution (imperfect) or just adding a line to source at the top of the runscript (the equivalent of the above, but if we can add the content directly, we should do that!)