Beispiel #1
0
    def connect_mongo(self, branch):
        """Connect to mongo db. """

        branch_dir = os.path.join(os.path.expanduser('~'), 'active', branch)

        if not os.path.isdir(branch_dir):
            raise Exception('Branch directory does not exist')

        config_dir = os.path.join(branch_dir, 'asdf', 'src', 'utils')
        sys.path.insert(0, config_dir)

        from config_utility import BranchConfig

        self.config = BranchConfig(branch=branch)

        # -------------------------------------

        # check mongodb connection
        if self.config.connection_status != 0:
            sys.exit("connection status error: " +
                     str(self.config.connection_error))

        # -------------------------------------

        self.client = pymongo.MongoClient(self.config.database)

        self.asdf = self.client.asdf.data

        self.is_connected = True
Beispiel #2
0
    def connect_mongo(self, branch):
        """Connect to mongo db. """

        from config_utility import BranchConfig

        self.config = BranchConfig(branch=branch)

        # -------------------------------------

        # check mongodb connection
        if self.config.connection_status != 0:
            sys.exit("connection status error: " +
                     str(self.config.connection_error))

        # -------------------------------------

        self.client = pymongo.MongoClient(self.config.database)

        self.asdf = self.client.asdf.data

        self.is_connected = True
Beispiel #3
0
"""

# -----------------------------------------------------------------------------

import sys
import os

branch = sys.argv[1]

utils_dir = os.path.join(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'utils')
sys.path.insert(0, utils_dir)

from config_utility import BranchConfig

config = BranchConfig(branch=branch)
config.test_connection()

# -----------------------------------------------------------------------------

import geo_rasterstats as rs

# -------------------------------------
# initialize mpi

import mpi_utility
job = mpi_utility.NewParallel(capture=True)

# -------------------------------------
# verify good mongo connection on all processors