Example #1
0
def queryUrlStatusListForJson(taskJobId):
    taskJobHistory = TaskJobDao.loadTaskJobHistoryFirstByTaskJobId(taskJobId)
    if taskJobHistory:
        sqlDataList = Session.query(UrlClazz).filter(
            UrlClazz.taskJobHistoryId == taskJobHistory.id,
            UrlClazz.delFlag == False).all()
        return swapParseTree(taskJobId, sqlDataList)
    else:
        return []
Example #2
0
def delUrlListByTaskJobId(taskJobId):
    tempData = {}
    tempData[UrlClazz.delFlag] = 1
    try:
        taskJobHistory = TaskJobDao.loadTaskJobHistoryFirstByTaskJobId(
            taskJobId)
        Session.query(UrlClazz).filter(
            taskJobHistory.id == UrlClazz.taskJobHistoryId).update(tempData)
        Session.commit()
    except Exception:
        logging.error('delUrlListByTaskJobId:%s:error:%s' %
                      (taskJobId, Exception))
        Session.rollback()
Example #3
0
def queryUrlStatusCountByTaskJobId(taskJobId):
    resultList = []
    taskJobHistory = TaskJobDao.loadTaskJobHistoryFirstByTaskJobId(taskJobId)
    for status in (UrlStatus.WAITING, UrlStatus.RUNNING, UrlStatus.STOP,
                   UrlStatus.FAIL, UrlStatus.SUCCESS, UrlStatus.PAUSE):
        if taskJobHistory:
            resultList.append(
                Session.query(func.count(UrlClazz.id)).filter(
                    UrlClazz.taskJobHistoryId == taskJobHistory.id,
                    UrlClazz.delFlag == False,
                    UrlClazz.status == status).scalar())
        else:
            resultList.append(0)
    return resultList
Example #4
0
def queryUrlStatusListByTaskJobId(taskJobId, status):
    taskJobHistory = TaskJobDao.loadTaskJobHistoryFirstByTaskJobId(taskJobId)
    if taskJobHistory:
        if status is None:
            urlStatusList = Session.query(UrlClazz).filter(
                UrlClazz.taskJobHistoryId == taskJobHistory.id,
                UrlClazz.delFlag == False).all()
        else:
            urlStatusList = Session.query(UrlClazz).filter(
                UrlClazz.taskJobHistoryId == taskJobHistory.id,
                UrlClazz.status == status, UrlClazz.delFlag == False).all()
        tempUrlStatusList = []
        for urlStatus in urlStatusList:
            tempUrlStatusList.append(parseClassToDict(urlStatus))
        return tempUrlStatusList
    else:
        return []
Example #5
0
def queryData(id):
    taskJob = TaskJobDao.loadTaskJobHistoryFirstByTaskJobId(id)
    searchTaskJob = SearchTaskDao.loadTaskById(id)
    taskSequenceId = taskJob.id
    type = searchTaskJob.type
    return anayse(type, taskSequenceId)