Commit 7e32d5f9 authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'mogon1_setup'

parents 20842118 befc807f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ find_path(MERCURY_INCLUDE_DIR mercury.h
        )

find_library(MERCURY_LIBRARY
        NAMES mercury
        NAMES mercury mercury_debug
        HINTS
        $ENV{HOME}/adafs/install/lib
        ${MERCURY_DIR}
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ find_path(MERCURY_UTIL_DIR
        )

find_library(MERCURY_UTIL_LIBRARY
        NAMES mercury_util
        NAMES mercury_util mercury_util_debug
        HINTS
        $ENV{HOME}/adafs/install/lib
        ${MERCURY_UTIL_DIR}
+62 −23
Original line number Diff line number Diff line
@@ -18,10 +18,20 @@ void shutdown_handler(int dummy) {
 * Returns the machine's hostname
 * @return
 */
string get_my_hostname() {
string get_my_hostname(bool short_hostname) {
    char hostname[1024];
    auto ret = gethostname(hostname, 1024);
    return ret == 0 ? string(hostname) : ""s;
    if (ret == 0) {
        string hostname_s(hostname);
        if (!short_hostname)
            return hostname_s;
        // get short hostname
        auto pos = hostname_s.find("."s);
        if (pos != std::string::npos)
            hostname_s = hostname_s.substr(0, pos);
        return hostname_s;
    } else
        return ""s;
}

int main(int argc, const char* argv[]) {
@@ -53,7 +63,7 @@ int main(int argc, const char* argv[]) {
            ("help,h", "Help message")
            ("mountdir,m", po::value<string>(), "User Fuse mountdir.")
            ("rootdir,r", po::value<string>(), "ADA-FS data directory")
            ("hostsfile", po::value<string>(), "Path to the hosts_file for all fs participants")
            ("hostfile", po::value<string>(), "Path to the hosts_file for all fs participants")
            ("hosts,h", po::value<string>(), "Comma separated list of hosts_ for all fs participants");
    po::variables_map vm;
    po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -64,45 +74,74 @@ int main(int argc, const char* argv[]) {
        return 1;
    }
    if (vm.count("mountdir")) {
        // XXX check that this is actually an existing directory and exit if not
        ADAFS_DATA->mountdir(vm["mountdir"].as<string>());
    }
    if (vm.count("rootdir")) {
        // XXX check that this is actually an existing directory and exit if not
        ADAFS_DATA->rootdir(vm["rootdir"].as<string>());
    }

    // TODO Hostfile parsing here...
    if (vm.count("hosts")) {
        auto hosts = vm["hosts"].as<string>();
        std::map<uint64_t, std::string> hostmap;
        uint64_t i = 0;
        auto found_hostname = false;
        auto hostname = get_my_hostname();
        if (hostname.size() == 0) {
            cerr << "Unable to read the machine's hostname" << endl;
            assert(hostname.size() != 0);
    // parse host parameters
    vector<string> hosts{};
    if (vm.count("hostfile")) {
        auto host_path = vm["hostfile"].as<string>();
        fstream host_file(host_path);
        if (host_file.is_open()) {
            for (string line; getline(host_file, line);) {
                hosts.push_back(line);
            }
        } else {
            cerr << "Hostfile path does not exist. Exiting ..." << endl;
            ADAFS_DATA->spdlogger()->error("{}() Hostfile path does not exist. Exiting ...", __func__);
            assert(host_file.is_open());
        }
    } else if (vm.count("hosts")) {
        // split comma separated host string
        boost::char_separator<char> sep(",");
        boost::tokenizer<boost::char_separator<char>> tok(hosts, sep);
        boost::tokenizer<boost::char_separator<char>> tok(vm["hosts"].as<string>(), sep);
        for (auto&& s : tok) {
            hostmap[i] = s;
            if (hostname == s) {
            hosts.push_back(s);
        }
    }
    // convert host parameters into datastructures
    std::map<uint64_t, std::string> hostmap;
    auto hosts_raw = ""s;
    if (!hosts.empty()) {
        auto i = static_cast<uint64_t>(0);
        auto found_hostname = false;
        auto hostname = get_my_hostname(false);
        if (hostname.empty()) {
            cerr << "Unable to read the machine's hostname" << endl;
            ADAFS_DATA->spdlogger()->error("{}() Unable to read the machine's hostname", __func__);
            assert(!hostname.empty());
        }
        for (auto&& host : hosts) {
            hostmap[i] = host;
            hosts_raw += host + ","s;
            if (hostname == host) {
                ADAFS_DATA->host_id(i);
                found_hostname = true;
            }
            i++;
        }
        if (!found_hostname) {
            ADAFS_DATA->spdlogger()->error("{}() Hostname was not found in given parameters. Exiting ...", __func__);
            cerr << "Hostname was not found in given parameters. Exiting ..." << endl;
            assert(found_hostname);
        }
        hosts_raw = hosts_raw.substr(0, hosts_raw.size() - 1);
    } else {
        // single node mode
        ADAFS_DATA->spdlogger()->info("{}() Single node mode set to self", __func__);
        auto hostname = get_my_hostname(false);
        hostmap[0] = hostname;
        hosts_raw = hostname;
        ADAFS_DATA->host_id(0);
    }
    ADAFS_DATA->hosts(hostmap);
    ADAFS_DATA->host_size(hostmap.size());
    ADAFS_DATA->rpc_port(fmt::FormatInt(RPCPORT).str());
        ADAFS_DATA->hosts_raw(hosts);
    }
    ADAFS_DATA->hosts_raw(hosts_raw);



    //set all paths
    ADAFS_DATA->inode_path(ADAFS_DATA->rootdir() + "/meta/inodes"s); // XXX prob not needed anymore
+0 −2
Original line number Diff line number Diff line
@@ -104,8 +104,6 @@ if [ "$CLUSTER" == "mogon1" ]; then
    wgetdeps "lz4" "https://github.com/lz4/lz4/archive/v1.8.0.tar.gz"
	# get snappy for rocksdb
    wgetdeps "snappy" "https://github.com/google/snappy/archive/1.1.7.tar.gz"
	# get pssh
	wgetdeps "pssh" "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/parallel-ssh/pssh-2.3.1.tar.gz"
fi

# get BMI
+1 −9
Original line number Diff line number Diff line
@@ -115,14 +115,6 @@ if [ "$CLUSTER" == "mogon1" ]; then
    cmake -DCMAKE_INSTALL_PREFIX=$INSTALL -DCMAKE_BUILD_TYPE:STRING=Release .. || exit 1
    make -j$CORES || exit 1
    make install || exit 1
	echo "############################################################ Installing:  pssh"
	CURR=$GIT/pssh
	cd $CURR
	python2 setup.py install
    if [ ! -d "$INSTALL/bin" ]; then
		mkdir $INSTALL/bin
	fi
	mv $CURR/bin/* $INSTALL/bin/ || exit 1
fi

if [ "$NA_LAYER" == "bmi" ] || [ "$NA_LAYER" == "all" ]; then
@@ -224,7 +216,7 @@ make install || exit 1
make check || exit 1

echo "############################################################ Installing:  Rocksdb"
# Margo
# Rocksdb
CURR=$GIT/rocksdb
cd $CURR
make clean || exit 1
Loading