Example #1
0
def get_batch_job_instance_data_by_id(request):
    # 根据ID获取批处理作业数据
    cur = Currency(request)
    batch_job_instance_id = cur.rq_post('instance_id')
    bjid = BatchJobInstanceData({})
    data = bjid.get_batch_job_instance_by_id(batch_job_instance_id)
    response = HttpResponse()
    response.write(json.dumps(data))
    return response
Example #2
0
def check_permission(request):
    # 检测用户权限
    nowuser = auth.get_user(request)
    cur = Currency(request)
    permission = cur.rq_post('permission')
    status = 0 if nowuser.has_perm(permission) else 1
    response = HttpResponse()
    response.write(json.dumps({'status': status}))
    return response
Example #3
0
def get_datax_job_instance_by_id(request):
    # 根据ID查询任务实例
    cur = Currency(request)
    _id = cur.rq_post('_id')
    conn = dataconn.DatabaseConnection(logger)
    dtf = dataconn.DataTransform()
    sql = config.select_datax_job_instance_by_id_sql % _id
    source_data = conn.ygol.getsingle(sql)
    response = HttpResponse()
    response.write(json.dumps(dtf.get_row_by_dict_to_user(source_data)))
    return response
Example #4
0
def get_batch_job_data_by_id(request):
    """
    根据ID获取批处理作业数据
    :param request: id
    :return:
    """
    cur = Currency(request)
    _id = cur.rq_post('_id')
    sql = config.query_batch_job_sql3 % _id
    dtconn = dataconn.DatabaseConnection(logger)
    dtsf = dataconn.DataTransform()
    source_data = dtconn.ygol.getsingle(sql)
    response = HttpResponse()
    response.write(json.dumps(dtsf.get_row_by_dict_to_user(source_data)))
    return response
Example #5
0
def get_batch_job_sub_job_by_id(request):
    """
    根据ID获取批处理作业中的子作业数据

    扩展:
         目前子作业只包含数据同步,后期加入了SQL脚本、SQL备份等等之后,
         需要先判断子作业的类型,再根据类型去相关表里查询子作业的详细信息。
         例如:如果有同步类型的子作业,就需要根据同步作业表查询同步的任务详情。
              如果有备份类型的,就去备份表里查询备份任务详情。
    :param request: id
    :return:
    """
    cur = Currency(request)
    _id = cur.rq_post('_id')
    sql = config.query_batch_job_sub_job_by_id_sql % _id
    dtconn = dataconn.DatabaseConnection(logger)
    dtsf = dataconn.DataTransform()
    source_data = dtconn.ygol.getall(sql)
    data = [dtsf.get_row_by_dict_to_user(dt) for dt in source_data]
    response = HttpResponse()
    response.write(json.dumps(data))
    return response