From e1be66312b536a419383746b8e702b6148edeeec Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Thu, 14 Sep 2017 19:54:54 +0100 Subject: [PATCH] Fix virtualenv activation for some scripts In particular add virtualenv activation to extract_dataset_parts.sh to fix the following error when running tools which use ``: ``` Fatal error: /tmp/tmpOoQ01k/job_working_directory/000/12/task_0: Traceback (most recent call last): File "./scripts/extract_dataset_part.py", line 17, in import galaxy.model.mapping # need to load this before we unpickle, in order to setup properties assigned by the mappers File "/opt/galaxyproject_galaxy_release_17.05/lib/galaxy/model/__init__.py", line 20, in from six import string_types ModuleNotFoundError: No module named 'six' ``` --- create_db.sh | 2 +- extract_dataset_parts.sh | 8 ++++++++ manage_db.sh | 2 +- manage_tools.sh | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/create_db.sh b/create_db.sh index 976d279e09b..e5eee61383c 100755 --- a/create_db.sh +++ b/create_db.sh @@ -1,5 +1,6 @@ #!/bin/sh +cd `dirname $0` : ${GALAXY_VIRTUAL_ENV:=.venv} if [ -d "$GALAXY_VIRTUAL_ENV" ]; @@ -8,5 +9,4 @@ then . "$GALAXY_VIRTUAL_ENV/bin/activate" fi -cd `dirname $0` python ./scripts/create_db.py $@ diff --git a/extract_dataset_parts.sh b/extract_dataset_parts.sh index 26f915c0c3d..840adc70a24 100755 --- a/extract_dataset_parts.sh +++ b/extract_dataset_parts.sh @@ -1,6 +1,14 @@ #!/bin/sh cd `dirname $0` +: ${GALAXY_VIRTUAL_ENV:=.venv} + +if [ -d "$GALAXY_VIRTUAL_ENV" ]; +then + printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n" + . "$GALAXY_VIRTUAL_ENV/bin/activate" +fi + for file in $1/split_info*.json do # echo processing $file diff --git a/manage_db.sh b/manage_db.sh index 6d4f3423d9b..80c01a49f75 100755 --- a/manage_db.sh +++ b/manage_db.sh @@ -5,6 +5,7 @@ # sh manage_db.sh downgrade --version=3 ####### +cd `dirname $0` : ${GALAXY_VIRTUAL_ENV:=.venv} if [ -d "$GALAXY_VIRTUAL_ENV" ]; @@ -13,5 +14,4 @@ then . "$GALAXY_VIRTUAL_ENV/bin/activate" fi -cd `dirname $0` python ./scripts/manage_db.py $@ diff --git a/manage_tools.sh b/manage_tools.sh index 67473f99782..234d1d85fd5 100644 --- a/manage_tools.sh +++ b/manage_tools.sh @@ -1,5 +1,6 @@ #!/bin/sh +cd `dirname $0` : ${GALAXY_VIRTUAL_ENV:=.venv} if [ -d "$GALAXY_VIRTUAL_ENV" ]; @@ -8,5 +9,4 @@ then . "$GALAXY_VIRTUAL_ENV/bin/activate" fi -cd `dirname $0` python ./scripts/manage_tools.py $@