Ejemplo n.º 1
0
 def get_input_table_info(parameters, role, party_id):
     search_type = data_utils.get_input_search_type(parameters)
     if search_type is InputSearchType.TABLE_INFO:
         return parameters["namespace"], parameters["name"]
     elif search_type is InputSearchType.JOB_COMPONENT_OUTPUT:
         output_data_infos = Tracker.query_output_data_infos(
             job_id=parameters["job_id"],
             component_name=parameters["component_name"],
             data_name=parameters["data_name"],
             role=role,
             party_id=party_id,
         )
         if not output_data_infos:
             raise Exception(
                 f"can not found input table, please check parameters")
         else:
             namespace, name = (
                 output_data_infos[0].f_table_namespace,
                 output_data_infos[0].f_table_name,
             )
             LOGGER.info(
                 f"found input table {namespace} {name} by {parameters}")
             return namespace, name
     else:
         raise ParameterError(
             f"can not found input table info by parameters {parameters}")
Ejemplo n.º 2
0
def query_component_output_data_info():
    output_data_infos = Tracker.query_output_data_infos(**request.json)
    if not output_data_infos:
        return get_json_result(retcode=101, retmsg='find data view failed')
    return get_json_result(retcode=0,
                           retmsg='success',
                           data=[
                               output_data_info.to_json()
                               for output_data_info in output_data_infos
                           ])
Ejemplo n.º 3
0
def component_output_data_table(job_id, component_name, role, party_id):
    output_data_infos = Tracker.query_output_data_infos(
        job_id=job_id,
        component_name=component_name,
        role=role,
        party_id=party_id)
    if output_data_infos:
        return get_json_result(retcode=0,
                               retmsg='success',
                               data=[{
                                   'table_name': output_data_info.f_table_name,
                                   'table_namespace':
                                   output_data_info.f_table_namespace,
                                   "data_name": output_data_info.f_data_name
                               } for output_data_info in output_data_infos])
    else:
        return get_json_result(
            retcode=100,
            retmsg='No found table, please check if the parameters are correct'
        )
Ejemplo n.º 4
0
def get_job_all_table(job):
    dsl_parser = schedule_utils.get_job_dsl_parser(dsl=job.f_dsl,
                                                   runtime_conf=job.f_runtime_conf,
                                                   train_runtime_conf=job.f_train_runtime_conf
                                                   )
    _, hierarchical_structure = dsl_parser.get_dsl_hierarchical_structure()
    component_table = {}
    component_output_tables = Tracker.query_output_data_infos(job_id=job.f_job_id, role=job.f_role,
                                                              party_id=job.f_party_id)
    for component_name_list in hierarchical_structure:
        for component_name in component_name_list:
            component_table[component_name] = {}
            component_input_table = get_component_input_table(dsl_parser, job, component_name)
            component_table[component_name]['input'] = component_input_table
            component_table[component_name]['output'] = {}
            for output_table in component_output_tables:
                if output_table.f_component_name == component_name:
                    component_table[component_name]['output'][output_table.f_data_name] = \
                        {'name': output_table.f_table_name, 'namespace': output_table.f_table_namespace}
    return component_table