Repository navigation
Conversation
Before downloading the coverage artifacts of a task, the bot listed all
of its artifacts to find the coverage ones, one listing call per task
(355 calls for the 555 coverage tasks of a recent mozilla-central task
group, after picking the best task for each chunk and platform).
The coverage artifact names only depend on the kind of task:
public/test_info/code-coverage-{grcov,jsvm}.zip for test kinds and
public/code-coverage-grcov.zip for build and source-test tasks. So,
before starting the downloads, list the artifacts of tasks of each kind
until one of them has coverage artifacts, log the names found for the
kind, and request those names directly for all the tasks of that kind.
On the same task group, this takes 8 listing calls.
Not all tasks have all artifacts (e.g. when they failed early), so a
404 is treated as the artifact being absent. download_file no longer
retries on 404, as retrying wouldn't make the artifact appear and would
waste minutes; other errors are still retried.
Also make the mock_tenacity fixture patch wait_exponential, which
download_file uses, so that tests exercising retries don't wait.
On the last mozilla-central run, the 642 artifacts (53.7 GB) were downloaded at 253 MB/s, with 6.9 downloads running at the same time on average out of 8. Each download only got ~36 MB/s (median), while the worker sustained ~350 MB/s overall when the Mercurial clone was running in parallel. So the throughput is limited by the speed of each download rather than by the network, and more parallel downloads should make the whole faster.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Before downloading the coverage artifacts of a task, the bot lists all of its artifacts (
listLatestArtifacts) to find the coverage ones. That is one listing call per downloaded task. On the mozilla-central task groupWCCcu_Z9TJuINVImjxA5hA, there are 555 coverage tasks, and 355 remain afterdownload_allpicks the best task for each chunk and platform, so that's 355 listing calls per run. The time saved is small, but it roughly halves the number of Taskcluster API requests.Change
ArtifactsHandler.find_artifact_namesgroups the tasks to download by kind (task["tags"]["kind"], falling back to the task name prefix if the tag is missing). For each kind, it lists the artifacts of the tasks one by one until one has coverage artifacts (same filter as before: names containingcode-coverage-grcov.zip/code-coverage-jsvm.zip). It records those full names for the kind and logs them, one info line per kind, so a future naming change shows up in the logs. If no task of a kind has coverage artifacts, the kind gets no names.ArtifactsHandler.downloadrequests the kind's names directly. A 404 means "this task doesn't have this artifact": it is logged and skipped, and noArtifactis recorded. Local paths andArtifactrecords are the same as before for artifacts that exist. Ifdownloadis called for a kind whose names are unknown, it learns them from that task.utils.download_fileno longer retries on HTTP 404, since retrying won't make the artifact appear and would cost minutes with the 16-64 s exponential waits. Other errors (e.g. 403, 500, bad zip files) are still retried 5 times, as before.mock_tenacitytest fixture now also patcheswait_exponential, whichdownload_fileuses. Before, retry tests really waited: the bot test suite drops from ~2.5 min to ~30-40 s locally.Artifact names per kind
I listed the artifacts of all 555 coverage tasks of
WCCcu_Z9TJuINVImjxA5hA. All of them have akindtag, and within each kind every task that has coverage artifacts uses the same names:public/test_info/code-coverage-grcov.zip,public/test_info/code-coverage-jsvm.zippublic/code-coverage-grcov.zippublic/code-coverage-grcov.zipThe build tasks without coverage artifacts are the fuzzing builds.
The change assumes that tasks of the same kind use the same names. If that stops being true, artifacts with new names would be silently missed, but the per-kind log line shows which names were used.
I ran
download_allagainst this task group withdownloadstubbed out, using the real Taskcluster API. It made 8 listing calls instead of 355. All 8 came from the 7 kinds: build needed 2 because the first build task had no coverage artifacts. The 355 tasks then need 704 direct download requests. Up to a few dozen of those can be 404s, for tasks that have no coverage artifacts at all, and each 404 costs one request.Tests
bot/tests/test_artifacts.pygo throughresponses. They cover:test_download_allnow checks that one listing call is made for the whole group.bot/tests/test_taskcluster.py:download_artifacton a 404 makes a single request and leaves no file behind, plus tests forget_task_kind.pytest bot/tests/test_artifacts.py bot/tests/test_taskcluster.py bot/tests/test_grcov.py bot/tests/test_reports.py(with grcov v0.10.9) passes. In the full bot test suite, the same tests fail as on master locally, for unrelated reasons (missing hg version / pushlog extension).This hasn't run on Taskcluster yet.
Download with 16 threads instead of 8
Second commit. On the last mozilla-central run (https://firefox-ci-tc.services.mozilla.com/tasks/bgdiwWLUQzuSAJbshFpQDg/runs/1), with the measurements from #3086: 642 artifacts (53.7 GB) downloaded in 212 s, i.e. 253 MB/s, with 6.9 downloads running at the same time on average out of 8. Each download got ~36 MB/s (median), while the worker sustained ~350 MB/s overall when the Mercurial clone was running in parallel. So the limit is the speed of each download, not the network, and more parallel downloads should be faster. The next run's summary line will tell.