Skip to content
Snippets Groups Projects
Verified Commit c41444d1 authored by ck85nori's avatar ck85nori :railway_track:
Browse files

adds chunk input script

parent 6f74416e
No related branches found
No related tags found
No related merge requests found
# zamba predict job pipeline
## chunk input
Zamba does not scale out. We can, however, reduce the turnaround time by chunking the input videos and submitting one job per chunk.
```bash
bash chunk-input.sh \
/data/GROUP/videos \
/data/GROUP/videos-chunked-10 \
10
```
#!/bin/bash
# -----------------------------------------------------------------------------
# command line arguments
# -----------------------------------------------------------------------------
[[ $# -eq 3 ]] || {
echo "usage: $(basename "$0") input_dir output_dir chunk_size" >&2
exit 1
}
input_dir=$1
output_dir=$2
chunk_size=$3
[[ -d $input_dir ]] || {
echo "$(basename "$0"): $input_dir does not exist" >&2
exit 1
}
[[ $chunk_size -gt 0 ]] || {
echo "$(basename "$0"): chunk size should be greater than 0" >&2
exit 1
}
# -----------------------------------------------------------------------------
# create chunked dirs
# -----------------------------------------------------------------------------
current_chunk=1
current_element=1
find "$input_dir" -type f | while read -r file ; do
if [[ $current_element -eq 1 ]] ; then
chunk_dir="$output_dir/chunk-$current_chunk"
mkdir -p "$chunk_dir"
fi
ln -t "$chunk_dir" "$file"
if [[ $current_element -lt $chunk_size ]] ; then
current_element=$(( current_element + 1 ))
else
current_element=1
current_chunk=$(( current_chunk + 1 ))
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment