Commit c284e897 authored by Maxime Hubert's avatar Maxime Hubert
Browse files

validate-execution: Update to handle relative filepaths

parent fe07b1ab
Pipeline #141560 passed with stage
in 33 seconds
......@@ -18,23 +18,25 @@ def entry_point(output, reference, activity_index, file_index, result, score):
"""
# go into the right directory to execute the script
path = os.path.dirname(__file__)
execution_validation_dir = os.path.join(path, '../implementation/validate_execution')
current_path = os.path.dirname(__file__)
execution_validation_dir = os.path.join(current_path, '../implementation/validate_execution')
installation_script = os.path.join(execution_validation_dir, 'install.sh')
script = os.path.join(execution_validation_dir, 'score.sh')
scoring_cmd = 'python2 ' + os.path.join(execution_validation_dir, 'ActEV_Scorer', 'ActEV_Scorer.py ActEV18_AD -v ')
script += " " + output
script += " " + reference if reference else " "
script += " " + activity_index
script += " " + file_index
script += " " + result if result else " "
script += " true" if score else " false"
scoring_cmd += " -s " + os.path.realpath(output)
scoring_cmd += " -r " + os.path.realpath(reference) if reference else " "
scoring_cmd += " -a " + os.path.realpath(activity_index)
scoring_cmd += " -f " + os.path.realpath(file_index)
scoring_cmd += " -o " + os.path.realpath(result) if result else " "
scoring_cmd += " " if score else " -V"
if not result and score:
raise Exception("Please provide a -R option when using --score")
# execute the script
# status is the exit status code returned by the program
status = os.system('cd ' + execution_validation_dir + \
'; . ' + installation_script + \
';' + script)
cmd = 'cd ' + execution_validation_dir + ';' + ' . ' + installation_script + ';' + scoring_cmd
status = os.system(cmd)
if status != 0:
raise Exception("Error occured in install.sh or score.sh")
#!/bin/bash
cd "$(dirname "$0")"
env_dir="python_env"
path=`pwd`
path=`realpath $(dirname $0)`
path_to_env_dir="$path/$env_dir"
if [ -d $path_to_env_dir ];then
. ./$env_dir/bin/activate
. $path_to_env_dir/bin/activate
else
sudo apt-get install python-dev -y
virtualenv -p /usr/bin/python2 $env_dir
. ./$env_dir/bin/activate
virtualenv -p python2 $path_to_env_dir
. $path_to_env_dir/bin/activate
python -m pip --no-cache-dir install -r requirements.txt
fi
#!/bin/bash
cd "$(dirname "$0")"
# Get the ActEV scorer submodule
git submodule update --init --recursive
if [ $? -ne 0 ];then
exit 1
fi
# Configure the scorer with the right arguments
output=$1
reference=$2
activity=$3
file=$4
result=$5
score=$6
# Execute ActEV Scorer
cd ActEV_Scorer
if [[ $score == "true" ]] ; then
python2 ActEV_Scorer.py \
ActEV18_AD \
-s $output \
-r $reference \
-a $activity \
-f $file \
-o $result \
-v
else
python2 ActEV_Scorer.py \
ActEV18_AD \
-s $output \
-a $activity \
-f $file \
-v \
-V
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment