xdmodaccount.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:supremm 作者: ubccr 项目源码 文件源码
def markasdone(self, job, success, elapsedtime, error=None):
        """ log a job as being processed (either successfully or not) """
        query = """
            INSERT INTO modw_supremm.`process` 
                (jobid, process_version, process_timestamp, process_time) VALUES (%s, %s, NOW(), %s)
            ON DUPLICATE KEY UPDATE process_version = %s, process_timestamp = NOW(), process_time = %s
            """

        if error != None:
            version = -1000 - error
        else:
            version = Accounting.PROCESS_VERSION if success else -1 * Accounting.PROCESS_VERSION

        data = (job.job_pk_id, version, elapsedtime, version, elapsedtime)

        if self.madcon == None:
            self.madcon = getdbconnection(self.dbsettings, False)

        cur = self.madcon.cursor()

        try:
            cur.execute(query, data)
        except OperationalError:
            logging.warning("Lost MySQL Connection. Attempting single reconnect")
            self.madcon = getdbconnection(self.dbsettings, False)
            cur = self.madcon.cursor()
            cur.execute(query, data)

        self.madcon.commit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号