-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathmagpie-setup-post
executable file
·86 lines (78 loc) · 3.18 KB
/
magpie-setup-post
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#############################################################################
# Copyright (C) 2013-2015 Lawrence Livermore National Security, LLC.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Albert Chu <[email protected]>
# LLNL-CODE-644248
#
# This file is part of Magpie, scripts for running Hadoop on
# traditional HPC systems. For details, see https://github.com/llnl/magpie.
#
# Magpie is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Magpie is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Magpie. If not, see <http://www.gnu.org/licenses/>.
#############################################################################
source ${MAGPIE_SCRIPTS_HOME}/magpie/exports/magpie-exports-submission-type
source ${MAGPIE_SCRIPTS_HOME}/magpie/exports/magpie-exports-dirs
source ${MAGPIE_SCRIPTS_HOME}/magpie/exports/magpie-exports-user
source ${MAGPIE_SCRIPTS_HOME}/magpie/lib/magpie-lib-node-identification
source ${MAGPIE_SCRIPTS_HOME}/magpie/lib/magpie-lib-setup
source ${MAGPIE_SCRIPTS_HOME}/magpie/lib/magpie-lib-paths
if Magpie_am_I_master
then
echo "*******************************************************"
echo "* Performing Post Setup"
echo "*******************************************************"
fi
if [ "${HADOOP_SETUP}" == "yes" ]
then
#
# Perform HDFS format if necessary
#
# will set hadoopnoderank
if Magpie_am_I_a_hadoop_node \
&& Magpie_hadoop_filesystem_mode_is_hdfs_type
then
# will set magpie_hdfs_format_file
Magpie_calculate_hdfs_format_file_path ${hadoopnoderank}
if [ ! -f ${magpie_hdfs_format_file} ]
then
# Only master will format the node
if Magpie_am_I_master
then
echo "*******************************************************"
echo "* Formatting HDFS Namenode"
echo "*******************************************************"
cd $HADOOP_HOME
# Don't check version, legacy 0.2X versioning could be used
if [ -x "${hadoopcmdprefix}/hdfs" ]
then
echo 'Y' | ${hadoopcmdprefix}/hdfs namenode -format
else
echo 'Y' | ${hadoopcmdprefix}/hadoop namenode -format
fi
touch ${magpie_hdfs_format_file}
else
# If this is the first time running, make everyone else wait
# until the format is complete
sleep 30
fi
fi
fi
fi
if Magpie_am_I_master
then
echo "*******************************************************"
echo "* Post Setup Complete"
echo "*******************************************************"
fi
exit 0