Skip to content

Commit

Permalink
create tool for easily uploading files to qfs on cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkamprath committed Jun 6, 2020
1 parent 3a74238 commit 21e5846
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spark-qfs-swarm/tools/upload_bz2_files_to_qfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

#
# Usage:
# ./upload_bz2_files_to_qfa.sh /local/path/to/source_dir /path/oth/qfs/destination_dir
#
# Will create docker container using the qfs-master image and connectiong to
# the spark_cluster_network swarm network.
#

source_dir=${1%/}

echo "Uploading files from $source_dir locally to $2 on QFS."
docker run -it \
--network spark_cluster_network \
--mount type=bind,src=$source_dir,dst=/data \
--env DESTINATION_DIR=$2 \
qfs-master:latest \
/bin/bash -c \
'qfs -fs qfs://qfs-master:20000 -mkdir $DESTINATION_DIR; for filename in /data/*.bz2; do echo "uploading - ${filename} to $DESTINATION_DIR"; ( cptoqfs -s qfs-master -p 20000 -d "${filename}" -k $DESTINATION_DIR -r 2 ); done; echo "Finished uploading files."'

0 comments on commit 21e5846

Please sign in to comment.