Пример #1
0
def multiTask(request):
    task_obj = task_handler.Task(request)
    if task_obj.is_valid():
        result = task_obj.run()
        return HttpResponse(json.dumps({'task_id': result}))

    return HttpResponse(json.dumps(task_obj.errors))
Пример #2
0
def massive_process(request):
    '批量命令执行及文件上传'
    task_obj=task_handler.Task(request)
    if task_obj.is_valid():
        task_id=task_obj.run()
        print('task_id',task_id)
        return HttpResponse(json.dumps({'task_id':task_id}))
    return HttpResponse(json.dumps(task_obj.errors))
Пример #3
0
def multitask(request):

    task_obj = task_handler.Task(request)
    if task_obj.is_valid():
        task_obj = task_obj.run()
        return HttpResponse(
            json.dumps({
                'task_id': task_obj.id,
                'timeout': task_obj.timeout
            }))
    return HttpResponse(json.dumps(task_obj.errors))
Пример #4
0
def multitask(request):
    # 生成一个对象
    task_obj = task_handler.Task(request)

    # 使用对象里的验证方法
    if task_obj.is_valid():
        # 验证通过
        task_id = task_obj.run()
        return HttpResponse(json.dumps({'task_id': task_id}))

    # 认证不通过,既发送错误信息给前端
    return HttpResponse(json.dumps(task_obj.errors))