Skip to content

Commit

Permalink
Update Docker volume paths for data folder
Browse files Browse the repository at this point in the history
  • Loading branch information
JPugetGil committed Jul 24, 2024
1 parent 41b441a commit 4bb997a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ This is the Dockerized version of the Berlin SPARQL Benchmark.

## Usage
```bash
docker run -v "$PWD:/data" vcity/bsbm generate [args]
docker run -v "$PWD:/data" vcity/bsbm generate-n [args]
docker run -v "$PWD:/data" vcity/bsbm qualification [args]
docker run -v "$PWD:/data" vcity/bsbm testdriver [args]
docker run -v "$PWD:/app/data" vcity/bsbm generate [args]
docker run -v "$PWD:/app/data" vcity/bsbm generate-n [args]
docker run -v "$PWD:/app/data" vcity/bsbm qualification [args]
docker run -v "$PWD:/app/data" vcity/bsbm testdriver [args]
```

If you want more information about the different arguments, please refer to the original documentation.
Expand Down
29 changes: 9 additions & 20 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,39 @@ fi

command=$1

# create /data folder if it doesn't exist
mkdir -p /data
chmod 777 /data
# create data folder if it doesn't exist
mkdir -p data
chmod 777 data

if [ "$command" = "generate" ] || [ "$command" = "generate-n" ]; then
if [ "$command" = "generate-n" ]; then
./$@

# get the -fn parameter value, if it exists else set it to "dataset"
fn=$(echo $@ | grep -oP '(?<=-fn )[^ ]+' || echo "dataset")
# get the -s parameter value, if it exists else set it to "nt"
s=$(echo $@ | grep -oP '(?<=-s )[^ ]+' || echo "nt")
mv $fn*.$s /data

# check if the -ud parameter exists
if [[ $@ == *"-ud"* ]]; then
udf=$(echo $@ | grep -oP '(?<=-udf )[^ ]+' || echo "dataset_update")
mv $udf*.nt /data
fi
mv dataset*.ttl data
elif [ "$command" = "generate" ]; then
./$@

# get the -fn parameter value, if it exists else set it to "dataset"
fn=$(echo $@ | grep -oP '(?<=-fn )[^ ]+' || echo "dataset")
# get the -s parameter value, if it exists else set it to "nt"
s=$(echo $@ | grep -oP '(?<=-s )[^ ]+' || echo "nt")
mv $fn*.$s /data
mv $fn*.$s data

# check if the -ud parameter exists
if [[ $@ == *"-ud"* ]]; then
udf=$(echo $@ | grep -oP '(?<=-udf )[^ ]+' || echo "dataset_update")
mv $udf*.nt /data
mv $udf*.nt data
fi
elif [ "$command" = "testdriver" ]; then
./$@

# get the -o parameter value, if it exists else set it to "dataset"
o=$(echo $@ | grep -oP '(?<=-o )[^ ]+' || echo "benchmark_result.xml")
mv $o /data
mv $o data
elif [ "$command" = "qualification" ]; then
./$@

# get the -ql parameter value, if it exists else set it to "dataset"
ql=$(echo $@ | grep -oP '(?<=-ql )[^ ]+' || echo "qual.log")
mv $ql /data
mv $ql data
else
echo "Invalid command: $command"
exit 1
Expand Down
8 changes: 5 additions & 3 deletions generate-n
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ then
echo "Please run this script from the exec directory"
exit 1
fi
if [ $# == 0 ]
if [ $# == 0 ] || [ $1 == "-help" ]
then
echo "For generator options type ./generate-n -help"
echo "Generator options: ./generate-n <number of versions> ?<init number of products>"
fi
# check that $1 is a integer
if ! [[ $1 =~ ^[0-9]+$ ]]
Expand All @@ -16,11 +16,13 @@ then
fi

number_of_versions=$1
products_number=${2:-1}
echo "Generating $number_of_versions versions"

# loop through the number of versions and call ./generate
for i in $(seq 1 $number_of_versions)
do
echo "Generating version $i"
./generate "${@:2}"
echo "Generating $((products_number + i)) products"
./generate -s ttl -pc $((products_number + i)) -tc $((i)) -ppt $((i)) -fn "dataset-$i"
done

0 comments on commit 4bb997a

Please sign in to comment.