Speed up the API Tests workflow without dropping any test
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start with .github/workflows/api-tests.yml and identify the API test command and its current checks. Measure individual QuantConnect.Tests.API.* test times in the workflow's quantconnect/lean:foundation image, then rank the slow tests and propose the stages on this issue while beginning the first stage. Done means all existing tests and checks still pass, with repeated local runs and before/after timings documented for each pull request.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behavior
The API Tests workflow (.github/workflows/api-tests.yml) takes noticeably less time, while running the same tests and checks it runs today.
Actual Behavior
It takes about 16.6 minutes on average, 18.6 at most, over its last 7 successful runs. It builds the solution, then runs the API tests (QuantConnect.Tests.API.*), which call the API.
Potential Solution
Scope:
- In stages, one pull request each. Start by measuring how long each test takes and posting a short plan on this issue: the worst offenders with their times, and the stages, worst offenders first, ordered by time saved for the effort, each a pull request that stands on its own and can be reviewed in one sitting: about 1,000 changed lines and fewer than 40 files at most. Then do the first stage in the same job, without waiting on the plan. Each pull request does one stage, says
Part of #9967rather than closing the issue, and ends with what's left for the next stage. The last stage's pull request closes the issue. When all of it fits within one pull request's limits, one pull request is fine, and it closes the issue. - Keep every test and check it runs today. No skipped, removed, filtered-out or weakened tests or assertions, and no lower coverage. The same tests have to pass, only faster.
- Make the tests themselves faster. Replace fixed sleeps with waiting on the condition they wait for, and share or cut repeated expensive setup.
- Use parallelism where tests are independent.
- Clean up after every test. Tests often leave tasks, threads, timers or engine instances running after they end, which slows down every test after them: stop and dispose of what each test starts.
- Mock where it helps, such as a slow external call or a heavy dependency a test doesn't check, as long as the test still checks what it set out to.
- Keep them consistent. Faster must not mean flaky: no race conditions, no state shared between tests running at once, no crashes or hangs. Run the changed suite several times in a row, in parallel where it runs in parallel, and put the number of runs and their results in the pull request. A test that already fails now and then gets fixed when the cause is in the test itself, such as a race in its setup, a fixed sleep or state shared with another test, not retried or skipped. When the cause is in the code under test, describe it in the pull request instead. CI runs for many pull requests also happen at the same time, against the same API account and the same runners, so a test can't rely on state another run could change: each run creates its own, as the API tests do with a new project every time. Sharing a project between tests or runs to save time would break that, so it's not a speed-up to take.
- Measure locally first, in the workflow's own
quantconnect/lean:foundationimage with its commands, and put the before and after times in the pull request. Push once the change is measured, not to try ideas on CI. - Use only this workflow's runners. On the pull request, cancel the runs of the other workflows, which this change doesn't affect, so the shared self-hosted runners stay free.
- Workflow file changes: if the speed-up needs a change to
.github/workflows/api-tests.ymlitself, describe it in the pull request description.
Calls to the API often wait on server-side work, such as a compile or a backtest finishing: poll the state they wait for, at a short interval, rather than sleeping a fixed time, and run independent fixtures at once.
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- Lingua principale
- C#
- Stelle
- 22.6k
- Fork
- 5.4k
- Merge medio
- 11h 39m
- PR unite (30g)
- 104
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di QuantConnect/Lean
-
priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
QuantConnect/Lean#10216 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
QuantConnect/Lean#10206 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
QuantConnect/Lean#10199 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
QuantConnect/Lean#10198 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
QuantConnect/Lean#10197 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di QuantConnect/Lean
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
dotnet-outdated/dotnet-outdated#871 ·
I maintainer di solito rispondono entro 1 giorno
-
triage/untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
unoplatform/uno#26676 ·
I maintainer di solito rispondono entro 1 giorno
-
.NET bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
[问题] 导出文件时,提示后面还有1243390911步Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
jhaizhou-ops/S2Arm#2177 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
area-CodeGen-coreclr untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dotnet/runtime#138181 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno