()
return jsonify({'msg': '启动成功', 'status': 1})
任务开启
任务开启
任务开启
def start_task():
    """ 任务开启 """
    data = request.json
    ids = data.get('id')
    _data = Task.query.filter_by(id=ids).first()
    config_time = change_cron(_data.task_config_time)
    cases_id = get_case_id(_data.project_id, json.loads(_data.set_id), json.loads(_data.case_id))
    scheduler.add_job(func=aps_test, trigger='cron', misfire_grace_time=60, coalesce=False,
                      args=[_data.project_id, cases_id, _data.task_send_email_address, _data.email_password,
                            _data.task_to_email_address, User.query.filter_by(id=current_user.id).first().name,
                            _data.send_email_status],
                      id=str(ids), **config_time)  # 添加任务
    _data.status = '启动'
    db.session.commit()

    return jsonify({'msg': '启动成功', 'status': 1})
def start_task ( ) : data = request . json ids = data . get ( 'id' ) _data = Task . query . filter_by ( id = ids ) . first ( ) config_time = change_cron ( _data . task_config_time ) cases_id = get_case_id ( _data . project_id , json . loads ( _data . set_id ) , json . loads ( _data . case_id ) ) scheduler . add_job ( func = aps_test , trigger = 'cron' , misfire_grace_time = 60 , coalesce = False , args = [ _data . project_id , cases_id , _data . task_send_email_address , _data . email_password , _data . task_to_email_address , User . query . filter_by ( id = current_user . id ) . first ( ) . name , _data . send_email_status ] , id = str ( ids ) , * * config_time ) # 添加任务 _data . status = '启动' db . session . commit ( ) return jsonify ( { 'msg' : '启动成功', 'statu s : 1})