LoginSignup
0
0
  • -n optionを使えばlogical cpuの数ほどprocessを割り当てる
  • logical cpuのかずを超えて設定するとthreadを割り当てる
  • threadに関して、global interpreter lockにより processごと一つのjobのみ動作すると知っているが、どういう原理でmulti threadingをするのかについてまではまだ分からない。調査が必要だ
  • -n autoを使えばpytest-xdistがlogical cpuの数を自動的に把握してその数ほどのprocessを割り当てる
  • -n autoに設定したprocessの数を超えて-n 으로 process数を指定したらmulti threadingが動作するのでIO boundで遅くなるtestを改善できるが test codeにIO boundが発生する部分がなければCPU boundを解決するmulti processingのみで十分だ

Reference
https://velog.io/@dahunyoo/파이썬의-병렬실행과-병렬테스트-Pytest-xdist
https://velog.io/@sangyeon217/pytest-plugin-pytest-xdist
https://pytest-xdist.readthedocs.io/en/stable/how-to.html#identifying-the-worker-process-during-a-test
https://blog.raccoony.dev/pytest-for-django-test/
https://qwlake.github.io/django/2020/06/05/building-django-test-environment/
https://blog.jerrycodes.com/pytest-split-and-github-actions/
https://pytest-xdist.readthedocs.io/en/stable/distribution.html#running-tests-across-multiple-cpus
https://qiita.com/yaboxi_/items/0cdc2818bf8acf6f00de
https://docs.pytest.org/en/7.1.x/how-to/tmp_path.html#the-tmp-path-factory-fixture

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0