Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query_job_list bug #566

Open
Lost-Temple opened this issue Mar 29, 2024 · 0 comments
Open

query_job_list bug #566

Lost-Temple opened this issue Mar 29, 2024 · 0 comments

Comments

@Lost-Temple
Copy link

System information

  • Have I written custom code (no):
  • OS Platform and Distribution (Mac 14.2.1 (23C71) ):
  • FATE Flow version (v2.1.0):
  • Python version (use command: python --version):

Describe the current behavior
当数据库表 t_job 中有记录的 f_parties 字段的值有多种格式,而flow中只考虑了一种形式引起的。
我现在表中f_parties 的值如:["JG0100001100000010", "JG0100001100000000"],flow对应的代码解析时就会出错,造成query_job_list返回为空了。
问题代码:fate_flow/python/fate_flow/controller/job.py的 224行
具体代码:

    @classmethod
    def query_job_list(cls, limit, page, job_id, description, partner, party_id, role, status, order_by, order,
                       user_name):
        # Provided to the job display page
        offset = limit * (page - 1)
        query = {'tag': ('!=', 'submit_failed')}
        if job_id:
            query["job_id"] = ('contains', job_id)
        if description:
            query["description"] = ('contains', description)
        if party_id:
            query["party_id"] = ('contains', party_id)
        # if partner:
        #     query["parties"] = ('contains', partner)
        if role:
            query["role"] = ('in_', set(role))
        if status:
            query["status"] = ('in_', set(status))
        by = []
        if order_by:
            by.append(order_by)
        if order:
            by.append(order)
        if not by:
            by = ['create_time', 'desc']
        if user_name:
            query["user_name"] = ("==", user_name)
        jobs, count = JobSaver.list_job(limit, offset, query, by)
        jobs = [job.to_human_model_dict() for job in jobs]
        lst_job = []
        for job in jobs:
            job['partners'] = set()
            for _r in job['parties']:  # job['parties']返回的数据有可能为:[{"role": "local", "party_id": ["0"]}],也有可能为["JG0100001100000000"]
                if isinstance(_r, dict):
                    job['partners'].update(_r.get("party_id"))  # 原代码中没有经过类型判断,这里是有bug的
                elif isinstance(_r, str):
                    job['partners'].update(_r)
                else:
                    continue
            job['partners'].discard(job['party_id'])
            job['partners'] = sorted(job['partners'])
            if partner and str(partner) not in job['partners']:
                continue
            lst_job.append(job)
        return count, lst_job

Describe the expected behavior

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

  • fateflow/logs/$job_id/fate_flow_schedule.log: scheduling log for a job
  • fateflow/logs/$job_id/* : all logs for a job
  • fateflow/logs/fate_flow/fate_flow_stat.log: a log of server stat
  • fateflow/logs/fate_flow/fate_flow_schedule.log: the starting scheduling log for all jobs
  • fateflow/logs/fate_flow/fate_flow_detect.log: the starting detecting log for all jobs

Contributing

  • Do you want to contribute a PR? (yes/no):
  • Briefly describe your candidate solution(if contributing):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant