예제 #1
0
    def __init__(self, ownHostname, host, port,
                sourceDir, storageDir, serviceToken,
                isMaster, maxGbRam=4, maxCores=4, logfileDirectory=None,
                shutdownTimeout=None, errorLogsOnly=False):
        self.host = host
        self.port = port
        self.storageDir = storageDir
        self.serviceToken = serviceToken
        self.logfileDirectory = logfileDirectory
        self.errorLogsOnly = errorLogsOnly

        self.lock = threading.Lock()

        if logfileDirectory is not None:
            if not os.path.exists(logfileDirectory):
                os.makedirs(logfileDirectory)

        if not os.path.exists(storageDir):
            os.makedirs(storageDir)

        if not os.path.exists(sourceDir):
            os.makedirs(sourceDir)

        def dbConnectionFactory():
            return connect(host, port, self.serviceToken)

        ServiceManager.__init__(
            self, dbConnectionFactory, sourceDir, isMaster, ownHostname,
            maxGbRam=maxGbRam, maxCores=maxCores, shutdownTimeout=shutdownTimeout
        )
        self.serviceProcesses = {}
        self._logger = logging.getLogger(__name__)
예제 #2
0
    def __init__(self, dbConnectionFactory):
        self.storageRoot = tempfile.TemporaryDirectory()
        self.sourceRoot = tempfile.TemporaryDirectory()

        ServiceManager.__init__(self,
                                dbConnectionFactory,
                                self.sourceRoot.name,
                                isMaster=True,
                                ownHostname="localhost")

        self.serviceWorkers = {}
    def __init__(self, dbConnectionFactory, auth_token):
        self.storageRoot = tempfile.TemporaryDirectory()
        self.sourceRoot = tempfile.TemporaryDirectory()
        self.auth_token = auth_token

        setCodebaseInstantiationDirectory(self.sourceRoot.name)

        ServiceManager.__init__(self,
                                dbConnectionFactory,
                                self.sourceRoot.name,
                                isMaster=True,
                                ownHostname="localhost")

        self.serviceWorkers = {}
    def __init__(self, ownHostname, host, port,
                 sourceDir, storageDir, authToken,
                 isMaster, maxGbRam=4, maxCores=4, logfileDirectory=None,
                 shutdownTimeout=None, logLevelName="INFO",
                 metricUpdateInterval=2.0
                 ):
        self.cleanupLock = threading.Lock()
        self.host = host
        self.port = port
        self.storageDir = storageDir
        self.authToken = authToken
        self.logfileDirectory = logfileDirectory
        self.logLevelName = validateLogLevel(logLevelName, fallback='INFO')

        self.lock = threading.Lock()

        if logfileDirectory is not None:
            if not os.path.exists(logfileDirectory):
                os.makedirs(logfileDirectory)

        if not os.path.exists(storageDir):
            os.makedirs(storageDir)

        if not os.path.exists(sourceDir):
            os.makedirs(sourceDir)

        def dbConnectionFactory():
            return connect(host, port, self.authToken)

        ServiceManager.__init__(
            self, dbConnectionFactory, sourceDir, isMaster, ownHostname,
            maxGbRam=maxGbRam, maxCores=maxCores, shutdownTimeout=shutdownTimeout,
            metricUpdateInterval=metricUpdateInterval
        )
        self.serviceProcesses = {}
        self._logger = logging.getLogger(__name__)