Skip to content

fix: replaced taskcluster rest api calls with package - #741

Merged
abhishekmadan30 merged 16 commits into
taskcluster:mainfrom
abhishekmadan30:issue-221
Sep 22, 2025
Merged

fix: replaced taskcluster rest api calls with package#741
abhishekmadan30 merged 16 commits into
taskcluster:mainfrom
abhishekmadan30:issue-221

Conversation

@abhishekmadan30

Copy link
Copy Markdown
Contributor

fixes #221 . Created a bunch of helpers to use this package in taskcluster.py . I also didnt completely depcreate the url creation as that is still used. I bypassed it and replaced all uses when to get request is made.

@ahal ahal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is shaping up nicely, thanks!

I have some changes to request. Once you put up a new revision I'll pull this down locally and see if it causes any differences in the graph (both here and in Gecko).

Comment thread src/taskgraph/run-task/fetch-content Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread taskcluster/scripts/codecov-upload.py Outdated
@abhishekmadan30
abhishekmadan30 requested a review from ahal August 19, 2025 19:45
@ahal

ahal commented Aug 19, 2025

Copy link
Copy Markdown
Contributor

Thanks! I'll take a closer look at this tomorrow. I'll try and test it against gecko_taskgraph as well.

@ahal ahal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, I tested this patch both in Taskgraph and the Gecko repo and it looks like it's working as expected!

But get_retry_post_session, _do_request and _handle_artifact are all unused now in taskcluster.py. Can you remove these and associated tests please?

@ahal

ahal commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

Also I think I changed my mind about leaving use_proxy in the function signature just for backwards compatibility.. We should remove it rather than confuse consumers who are attempting to set it to False or whatnot and then wondering why it isn't working.

We can do a major version bump for this.. no big deal.

@ahal ahal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

This is mostly cleanup, but there are two issues I neglected to catch in my first review:

  1. The _handle_artifact for yaml
  2. The .capitalize() issue

Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py
Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
continue

raise e
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you sure the taskcluster client would return None on a 404? I would have thought it would raise an exception still.. Though it would probably be from aiohttp rather than requests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(I assume you verified this? It's important to preserve the 404 behaviour here)

Comment thread test/test_optimize_strategies.py
@ahal ahal added the BREAKING CHANGE Backwards incompatible request that will require major version bump label Sep 3, 2025

@ahal ahal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Sorry for the delay + additional iteration. Getting close :)

Comment thread src/taskgraph/actions/retrigger.py
Comment thread src/taskgraph/actions/retrigger.py Outdated
Comment thread src/taskgraph/actions/retrigger.py Outdated
except HTTPError as e:
if e.response.status_code != 404:
raise
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I might be wrong, but I think if public/label-to-taskid.json is a 404 then it would raise an exception rather than return None. So this else clause is probably dead code.

Comment thread src/taskgraph/actions/util.py
Comment thread src/taskgraph/docker.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did these type failures start happening as a result of your changes? Or do you get these errors even on main? If the latter, I wonder if there's something you need to do locally to get the type checker working

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These happened because of my change because currently task_def could be a json or a responce if it fails

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Comment thread src/taskgraph/util/taskcluster.py Outdated
Comment thread src/taskgraph/util/taskcluster.py Outdated
except requests.HTTPError as e:
task_def = get_task_definition(task_id)
except Exception as e:
raise e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-raising the exception without doing anything is the same as not catching it in the first place. So you might as well remove the try/except block.

Comment thread src/taskgraph/util/taskcluster.py Outdated
continue

raise e
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(I assume you verified this? It's important to preserve the 404 behaviour here)

@ahal ahal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, lgtm!

I think schema change is close enough to landing that maybe we should land this and that at roughly the same time so we can avoid requiring two separate major version bumps.

@abhishekmadan30
abhishekmadan30 merged commit 41211fd into taskcluster:main Sep 22, 2025
23 checks passed
jcristau added a commit to jcristau/taskgraph that referenced this pull request Oct 1, 2025
jcristau added a commit to jcristau/taskgraph that referenced this pull request Oct 1, 2025
jcristau added a commit to jcristau/taskgraph that referenced this pull request Oct 1, 2025
jcristau added a commit to jcristau/taskgraph that referenced this pull request Oct 1, 2025
ahal pushed a commit that referenced this pull request Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE Backwards incompatible request that will require major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the Taskcluster Python client rather than direct http requests

2 participants