Exemple #1
0
def deleteTask():
    taskId = flask.request.form.get('id')
    if not taskId:
        return flask.jsonify({'code': ErrorCode.NoTaskIdInReq})
    try:
        _requestTaskServerRetCode(taskId, TaskRequestType.StopTask)
    except:
        config.Log.info('can not kill module')
    
    TaskStateDao.deleteTaskState(taskId, getUserId())
    code = TaskDao.deleteTask(taskId, getUserId())

    try:
        lltsIdList = StateClanDao.delByTaskId(taskId, getUserId())
    except:
        config.Log.info('can not kill module while delete task')
    return flask.jsonify({'code': code})
Exemple #2
0
def delWorkFlow():
    userId = getUserId()
    # 删除流程
    flowId = flask.request.form.get('id')
    if not flowId:
        return flask.jsonify({'code': ErrorCode.NoFlowIdInReq})
    
    flow = WorkFlowDao.queryWorkflow(flowId, userId)
    if flow.userId != userId:
        return flask.jsonify({'code': ErrorCode.CannotDeleteMutualFlow})
    
    UiDataDao.deleteUiDataByFlowId(flowId, userId)
    taskIdList = TaskDao.queryTaskIdByFlowId(flowId, userId)
    for id in taskIdList:
        TaskStateDao.deleteTaskState(id, userId)
    TaskDao.deleteByFlowId(flowId, userId)
    code = WorkFlowDao.deleteWorkflow(flowId, userId)
    return flask.jsonify({'code': code})