Skip to content

Commit

Permalink
Merge pull request #211 from broadinstitute/run-pipe-config-file-revert
Browse files Browse the repository at this point in the history
reverted change to run-pipe that allowed passing in the path to a config file
  • Loading branch information
dpark01 committed Feb 19, 2016
2 parents 63440aa + c23cd0c commit d62e426
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 46 deletions.
26 changes: 3 additions & 23 deletions pipes/Broad_LSF/run-pipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,10 @@ source /broad/software/scripts/useuse
reuse -q LSF
source $SCRIPT_DIRECTORY/../Broad_common/setup_dotkits.sh

# uses the first argument as the config file path, is specified
if [[ ! -z "$1" && "$1" != " " ]]; then
CONFIG_FILE=$1
else
# otherwise the config file is assumed to be "config.yaml" in the cwd
CONFIG_FILE="config.yaml"
fi

# resolve the config file path in full
CONFIG_FILE=`python -c "import os; print( os.path.realpath(os.path.expanduser(\"$CONFIG_FILE\"))) "`

# if the config file does not exist
# it is either not in the cwd, or what the user passed in does not exist
if [[ ! -f $CONFIG_FILE ]]; then
echo "Config file does not exist: $CONFIG_FILE"
echo " Usage: $(basename $0) [path/to/config.yaml]"
echo " A file called 'config.yaml' must exist in the current directory, or be passed in."
exit 1
fi

# load config dirs from config.yaml. After using the conda dotkit, we should have PyYAML
VENVDIR=`python -c "import yaml, os;f=open(\"$CONFIG_FILE\");print(os.path.realpath(yaml.safe_load(f)['venv_dir']));f.close()"`
BINDIR=`python -c "import yaml, os;f=open(\"$CONFIG_FILE\");print(os.path.realpath(yaml.safe_load(f)['bin_dir']));f.close()"`
DATADIR=`python -c "import yaml, os; f=open(\"$CONFIG_FILE\");print(os.path.realpath(yaml.safe_load(f)['data_dir']));f.close()"`
VENVDIR=`python -c "import yaml, os;f=open(\"config.yaml\");print(os.path.realpath(yaml.safe_load(f)['venv_dir']));f.close()"`
BINDIR=`python -c "import yaml, os;f=open(\"config.yaml\");print(os.path.realpath(yaml.safe_load(f)['bin_dir']));f.close()"`
DATADIR=`python -c "import yaml, os; f=open(\"config.yaml\");print(os.path.realpath(yaml.safe_load(f)['data_dir']));f.close()"`

# load Python virtual environment
source "$VENVDIR/bin/activate"
Expand Down
26 changes: 3 additions & 23 deletions pipes/Broad_UGER/run-pipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,10 @@ source /broad/software/scripts/useuse
reuse -q UGER
source $SCRIPT_DIRECTORY/../Broad_common/setup_dotkits.sh

# uses the first argument as the config file path, is specified
if [[ ! -z "$1" && "$1" != " " ]]; then
CONFIG_FILE=$1
else
# otherwise the config file is assumed to be "config.yaml" in the cwd
CONFIG_FILE="config.yaml"
fi

# resolve the config file path in full
CONFIG_FILE=`python -c "import os; print( os.path.realpath(os.path.expanduser(\"$CONFIG_FILE\"))) "`

# if the config file does not exist
# it is either not in the cwd, or what the user passed in does not exist
if [[ ! -f $CONFIG_FILE ]]; then
echo "Config file does not exist: $CONFIG_FILE"
echo " Usage: $(basename $0) [path/to/config.yaml]"
echo " A file called 'config.yaml' must exist in the current directory, or be passed in."
exit 1
fi

# load config dirs from config.yaml. After using the conda dotkit, we should have PyYAML
VENVDIR=`python -c "import yaml, os;f=open(\"$CONFIG_FILE\");print(os.path.realpath(yaml.safe_load(f)['venv_dir']));f.close()"`
BINDIR=`python -c "import yaml, os;f=open(\"$CONFIG_FILE\");print(os.path.realpath(yaml.safe_load(f)['bin_dir']));f.close()"`
DATADIR=`python -c "import yaml, os; f=open(\"$CONFIG_FILE\");print(os.path.realpath(yaml.safe_load(f)['data_dir']));f.close()"`
VENVDIR=`python -c "import yaml, os;f=open(\"config.yaml\");print(os.path.realpath(yaml.safe_load(f)['venv_dir']));f.close()"`
BINDIR=`python -c "import yaml, os;f=open(\"config.yaml\");print(os.path.realpath(yaml.safe_load(f)['bin_dir']));f.close()"`
DATADIR=`python -c "import yaml, os; f=open(\"config.yaml\");print(os.path.realpath(yaml.safe_load(f)['data_dir']));f.close()"`

# load Python virtual environment
source "$VENVDIR/bin/activate"
Expand Down

0 comments on commit d62e426

Please sign in to comment.