File: startup_hdfs.sh

package info (click to toggle)
dask 1.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,856 kB
  • sloc: python: 51,266; sh: 178; makefile: 142
file content (37 lines) | stat: -rw-r--r-- 891 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

HOSTDIR=$(pwd)
INIT_MARKER=$HOSTDIR/hdfs-initialized-indicator

# Remove initialization marker
rm -f $INIT_MARKER

# Start the hdfs service
echo "Starting Docker Container..."
CONTAINER_ID=$(docker run -d -v $(pwd):/working daskdev/dask-hdfs-testing)
export CONTAINER_ID

# Error immediately if this fails
if [ $? -ne 0 ]; then
    echo "Failed starting HDFS container"
    exit 1
fi
echo "DONE"

# Wait for initialization
CHECK_RUNNING="docker top $CONTAINER_ID"
while [[ $($CHECK_RUNNING) ]] && [[ ! -f $INIT_MARKER ]]
do
    sleep 1
done

# Error out if the container failed starting
if [[ ! $($CHECK_RUNNING) ]]; then
    echo "HDFS startup failed! Logs follow"
    echo "-------------------------------------------------"
    docker logs $CONTAINER_ID
    echo "-------------------------------------------------"
    exit 1
fi

echo "Started HDFS container: $CONTAINER_ID"