Skip to content

Restore get_pmax_performance, get_pmax_assets and get_detailed_asset_performance - #125

Open
illia-sapryga wants to merge 1 commit into
kLOsk:mainfrom
illia-sapryga:fix/pmax-read-tools
Open

illia-sapryga wants to merge 1 commit into
kLOsk:mainfrom
illia-sapryga:fix/pmax-read-tools

Conversation

@illia-sapryga

Copy link
Copy Markdown
Contributor

get_pmax_performance, get_pmax_assets and get_detailed_asset_performance all fail when called:

cannot import name 'get_pmax_performance' from 'adloop.ads.pmax'

d650c24 (draft_asset_group_assets) rewrote ads/pmax.py and the three read functions went with it. The wrappers in server.py import them inside the function body, so the server starts, the tools are listed, and only a call fails. No test calls them, which is why CI stayed green. It is in every release since that commit, including 0.37.0.

This adds the three functions back exactly as they were before d650c24, under a "Read tools" section, along with the two imports they need.

tests/test_pmax_read.py covers each of the three functions with a stubbed query layer. It also walks server.py for every from adloop... import x inside a function and checks that it resolves, so a function going missing from any tool module fails CI instead of failing at call time. That check passes for all the other tools today, so these three were the only ones affected.

What it does not do: I did not change what the functions return. get_pmax_performance still lists removed campaigns and their asset groups, so its ad-strength insight can flag a group in a removed campaign. That was already the behaviour, and it could be a separate change if you want it.

Tested with the full suite, and I ran all three functions read-only against a live Performance Max account: campaigns, asset groups and assets came back as expected. get_detailed_asset_performance returned no error but zero combinations on that account, so its row parsing is covered by neither the live run nor the test.

draft_asset_group_assets replaced pmax.py and dropped get_pmax_performance,
get_asset_performance and get_detailed_asset_performance. The wrappers in
server.py import them when called, so all three tools failed with an import
error at call time while the server started and tests passed. Add them back
unchanged, plus a test that every tool wrapper's lazy import resolves.

This branch has not been deployed

No deployments
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.

1 participant