Commit c07a6672 authored by Alexandre Boyer's avatar Alexandre Boyer
Browse files

WIP add new option to get-system, reset-chunk

parent 19709395
......@@ -13,19 +13,48 @@ output=$8
chunks_result=$9
tmp_file="chunk_ids.tmp"
function should_exit {
exit_status=$1
if [ $exit_status -ne 0 ];then
exit 1
fi
}
function should_cleanup_exit {
exit_status=$1
if [ $exit_status -ne 0 ];then
actev experiment-cleanup
exit 1
fi
}
function should_continue {
exit_status=$1
chunk_id=$2
if [ $exit_status -ne 0 ];then
actev reset-chunk -i $chunk_id
continue
fi
}
actev design-chunks -f $file_index -a $activity_index -o $chunks -n $number_of_videos
should_exit $?
actev experiment-init -f $file_index -a $activity_index -c $chunks -v $video_location -s $system_cache_dir
should_cleanup_exit $?
# Get chunks
python3 get_chunks_ids.py $chunks $tmp_file
should_cleanup_exit $? "actev experiment-cleanup"
for chunk_id in $(cat $tmp_file); do
actev pre-process-chunk -i $chunk_id
should_continue $? $chunk_id
actev process-chunk -i $chunk_id
should_continue $? $chunk_id
actev post-process-chunk -i $chunk_id
actev reset-chunk -i $chunk_id
should_continue $? $chunk_id
done
rm $tmp_file
actev merge-chunks -o $output -c $chunks_result -r $system_cache_dir
......
......@@ -6,7 +6,7 @@ This file should not be modified.
import os
from diva_evaluation_cli.bin.private_src.system_types.system_types_definition import system_types
def entry_point(url, system_type, location="None", user="None", password="None", token="None"):
def entry_point(url, system_type, location="None", user="None", password="None", token="None", install_cli=False):
""" Private entry points.
"""
try:
......@@ -23,6 +23,10 @@ def entry_point(url, system_type, location="None", user="None", password="None",
password = "None"
if not token:
token = "None"
if install_cli:
install_cli = "True"
else:
install_cli = "False"
# go into the right directory to execute the script
path = os.path.dirname(__file__)
......@@ -31,10 +35,11 @@ def entry_point(url, system_type, location="None", user="None", password="None",
" " + location + \
" " + user + \
" " + password + \
" " + token
" " + token + \
" " + install_cli
# execute the script
# status is the exit status code returned by the program
status = os.system(script)
if status != 0:
raise Exception("Error occured in exec.sh")
raise Exception("Error occured in %s" % command.entry_point)
......@@ -8,11 +8,11 @@ Clones a git repository
Args
----
location or l: path to store the system
user or U: url to get the system
password or p: password to access the url
token or t: token to access the url
location or l: path to store the system
user or U: url to get the system
password or p: password to access the url
token or t: token to access the url
install-cli or i: install the cli to use it
Warning: this file should not be modified.
"""
......@@ -34,5 +34,6 @@ class ActevGetSystemGit(ActevCommand):
arg_parser.add_argument("-p", "--password", help="password to access the url")
arg_parser.add_argument("-l", "--location", help="path to store the system")
arg_parser.add_argument("-t", "--token", help="token to access the url", type=str)
arg_parser.add_argument("-i", "--install-cli", help="install the cli to use it", action='store_true')
......@@ -5,7 +5,9 @@ location=$2
user=$3
password=$4
token=$5
cli=$6
# If there are credentials
if [ $user != "None" ];then
if [ $password != "None" ]; then
credentials="${user}:${password}@"
......@@ -23,8 +25,23 @@ if [ $user != "None" ];then
url="${http}//${credentials}${git}/${end}"
fi
# If there is a location
if [ $location != "None" ];then
cd $location
fi
git clone $url
# If the system has to be installed
if [ $cli == "True" ];then
repo_name=`echo $url | rev | cut -d '.' -f2 | rev`
cd $repo_name
echo $PATH | grep /.local/bin
if [ $? -ne 0 ];then
PATH="${PATH}:~/.local/bin"
export $PATH
fi
python3 -m pip install setuptools --user
python3 -m pip install . --user
fi
#!/bin/bash
cd "$(dirname "$0")"
FILE_INDEX=$1
ACTIVITY_INDEX=$2
CHUNK=$3
VIDEO_LOCATION=$4
SYSTEM_CACHE_DIRECTORY=$5
docker ps -a | grep rc3d 1> /dev/null
if [ $? -eq 0 ];then
./clean_up.sh
fi
nvidia-docker run -itd --name rc3d \
-v ${VIDEO_LOCATION}:/data/diva/v1-frames \
-v ${SYSTEM_CACHE_DIRECTORY}:/data/diva/system-cache \
......@@ -14,3 +21,4 @@ nvidia-docker run -itd --name rc3d \
nvidia-docker cp ${FILE_INDEX} rc3d:/data/diva/nist-json/file-index.json
nvidia-docker cp ${ACTIVITY_INDEX} rc3d:/data/diva/nist-json/activity-index.json
nvidia-docker cp ${CHUNK} rc3d:/data/diva/nist-json/chunk.json
Markdown is supported
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