Skip to content

Conversation

@wanghuancoder
Copy link
Contributor

@wanghuancoder wanghuancoder commented Jan 9, 2025

PR Category

Execute Infrastructure

PR Types

New features

Description

增加抓取API调用配置的能力,抓取的API配置可用于自动化测试。

用法:

export FLAGS_trace_api="/data/api.yaml,/data/api_config.txt"

# api.yaml
apis:
  -  paddle.abs
  -  paddle.abs_
  -  paddle.acos
  -  paddle.acosh
  -  paddle.addmm
  -  paddle.all
  -  paddle.amax

Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Jan 9, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

def start_api_tracer(api_path, save_config_path):
import paddle

print(paddle.__version__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议使用 logging

setattr(HookAPIMap, api, getattr(eval(parent_package), method_name))
setattr(eval(parent_package), method_name, wrapped_api(api))
except Exception as err:
print("[api_tracer error] : start_api_tracer ", api, str(err))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

save_config_path = os.environ.get(
"FLAGS_trace_api_save_config_path", "api_configs.txt"
)
start_api_tracer(api_path, save_config_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议整合一下 FLAG

result = result + key + "=" + tmp + ", "

result = result + ")"
# self.file.write(") -> ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete unused code

zhangbo9674
zhangbo9674 previously approved these changes Jan 16, 2025
Copy link
Contributor

@zhangbo9674 zhangbo9674 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanghuancoder wanghuancoder merged commit 4191e06 into PaddlePaddle:develop Jan 20, 2025
31 checks passed
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

Successfully merging this pull request may close these issues.

3 participants