示例#1
0
文件: index.py 项目: richardy2012/app
    def run(self):
        while True:

            # 打开连接
            start_connect(sqlite_db_use=False)

            try:
                container_monitor.init()
                login_log("container_monitor_script", "完成一次应用状态扫描!")
            except Exception as err:
                login_log("container_monitor_script_error", err.args[0])
                time.sleep(5)

            try:
                if not task_execute.init():
                    login_log("task_script", "任务队列没有任务")
                login_log("task_script", "完成一次任务调度!")
            except Exception as err:
                login_log("task_script_error", err.args[0])
                time.sleep(5)

            # 关闭数据库
            close_connect(sqlite_db_use=False)

            time.sleep(5)
示例#2
0
文件: index.py 项目: mumulizi/app
    def run(self):
        while True:

            # 打开连接
            start_connect(sqlite_db_use=False)

            try:
                container_monitor.init()
                login_log("container_monitor_script", "完成一次应用状态扫描!")
            except Exception as err:
                login_log("container_monitor_script_error", err.args[0])
                time.sleep(5)

            try:
                if not task_execute.init():
                    login_log("task_script", "任务队列没有任务")
                login_log("task_script", "完成一次任务调度!")
            except Exception as err:
                login_log("task_script_error", err.args[0])
                time.sleep(5)

            # 关闭数据库
            close_connect(sqlite_db_use=False)

            time.sleep(5)
示例#3
0
def __db_close():
    close_connect()
示例#4
0
文件: maintain.py 项目: mumulizi/app
for t in objs:
    obj['id'] = t[0]
    obj['api_url'] = t[1]
    obj['container_id'] = t[2]
    obj['app_id'] = t[3]
    obj['host'] = t[4]
    obj['port'] = t[5]
    login_log("maintain", "发现孤儿容器,所属应用id:%d,容器id:%s,容器域名:%s,容器端口:%d" % (obj['app_id'],
                                                                        obj['container_id'], obj['host'], obj['port']))
    api_url = obj['api_url'] + "remove"
    data = {
        "containerId": obj['container_id']
    }
    r = request_api(api_url, data)
    if r.status_code == 200:
        d = json.loads(r.text)
        if d['code'] == 0:
            # 删除容器成功
            dao = AppContainModel.delete().where(AppContainModel.id == obj['id'])
            dao.execute()
            login_log("maintain", "删除孤儿容器成功,所属应用id:%d,容器id:%s,容器域名:%s,容器端口:%d" % (obj['app_id'],
                                                                                  obj['container_id'], obj['host'],
                                                                                  obj['port']))
            continue
    login_log("maintain_error", "删除孤儿容器失败,所属应用id:%d,容器id:%s,容器域名:%s,容器端口:%d" % (obj['app_id'],
                                                                                obj['container_id'], obj['host'],
                                                                                obj['port']))

close_connect(sqlite_db_use=False)
print("清除孤儿容器结束")
示例#5
0
文件: index.py 项目: Chanran/app
def __db_close():
    close_connect()