コード例 #1
0
ファイル: connection.py プロジェクト: pegasus-isi/pegasus
def _backup_db(dburi):
    """
    Create a copy of the database (SQLite).
    :param dburi: DB URI
    """
    mask = None
    if urlparse(dburi).scheme == "sqlite":
        db_path = urlparse(dburi).path[1:]
        if os.path.isfile(db_path):
            log.info("Rotating sqlite db file %s" % db_path)
            mask = os.stat(db_path)[ST_MODE]
            utils.rotate_log_file(db_path)

    return mask
コード例 #2
0
def _backup_db(dburi):
    """
    Create a copy of the database (SQLite).
    :param dburi: DB URI
    """
    mask = None
    if urlparse(dburi).scheme == 'sqlite':
        db_path = urlparse(dburi).path[1:]
        if os.path.isfile(db_path):
            log.info('Rotating sqlite db file %s' % db_path)
            mask = os.stat(db_path)[ST_MODE]
            utils.rotate_log_file(db_path)

    return mask
コード例 #3
0
def monitord_launch(monitord_bin, arguments=[]):
    '''Launches Monitord in condor daemon mode'''
    if monitord_bin != None:
        try:
            # Rotate log file, if it exists
            # PM-688
            logfile = "monitord.log"
            utils.rotate_log_file(logfile)
            #we have the right name of the log file
            log = open(logfile, 'a', 1)
            monitord_proc = subprocess.Popen(
                [monitord_bin, "-N",
                 os.getenv('_CONDOR_DAGMAN_LOG')],
                stdout=log.fileno(),
                stderr=subprocess.STDOUT)
            log.close()
            logger.info("Launched Monitord with Pid %d" % monitord_proc.pid)
            return monitord_proc
        except OSError, err:
            logger.error("Could not launch Monitord.", err)
コード例 #4
0
def monitord_launch(monitord_bin, arguments=[]):
    """Launches Monitord in condor daemon mode"""
    if monitord_bin is not None:
        try:
            # Rotate log file, if it exists
            # PM-688
            logfile = "monitord.log"
            utils.rotate_log_file(logfile)
            # we have the right name of the log file
            log = open(logfile, "a", 1)
            monitord_proc = subprocess.Popen(
                [monitord_bin, "-N", os.getenv("_CONDOR_DAGMAN_LOG")],
                stdout=log.fileno(),
                stderr=subprocess.STDOUT,
            )
            log.close()
            logger.info("Launched Monitord with Pid %d" % monitord_proc.pid)
            return monitord_proc
        except OSError as err:
            logger.error("Could not launch Monitord.", err)
    else:
        logger.error("pegausus-monitord not found")
    return None