xdist-scheduling-exclusive


Namexdist-scheduling-exclusive JSON
Version 1.2.0 PyPI version JSON
download
home_page
Summarypytest-xdist scheduler that runs some tests on dedicated workers. can significantly improve runtime by running long tests on separate workers.
upload_time2024-03-09 08:12:07
maintainer
docs_urlNone
author
requires_python>=3.9
licenseCopyright (c) 2021 Andrey Sorokin <andrey@sorokin.engineer> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords log log-handler opensearch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://github.com/andgineer/xdist-scheduling-exclusive/workflows/CI/badge.svg)](https://github.com/andgineer/xdist-scheduling-exclusive/actions)
[![Coverage](https://raw.githubusercontent.com/andgineer/xdist-scheduling-exclusive/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/andgineer/xdist-scheduling-exclusive/blob/python-coverage-comment-action-data/htmlcov/index.html)
# xdist-scheduling-exclusive

pytest-xdist scheduler that runs some tests on dedicated workers. 

Can significantly improve runtime by running long tests on separate 
workers.

Also in `conftest.py` you can find handy reporting capabilities to see how tests were scheduled.

# Installation

```bash
pip install xdist-scheduling-exclusive pytest-xdist
```

# Usage

To integrate with your pytest setup, update conftest.py as follows:

```python
from xdist_scheduling_exclusive import ExclusiveLoadScopeScheduling

def pytest_xdist_make_scheduler(config, log):
    """xdist-pytest hook to set scheduler."""
    return ExclusiveLoadScopeScheduling(config, log)
```

And place exclusive tests file `exclusive_tests.txt` in `tests/resources/`.

You can get the list with pytest's
[--durations](https://docs.pytest.org/en/latest/how-to/usage.html#profiling-test-execution-duration)
option that also sort tests by execution time. 
Do not forget to clear execution time from the file - there should be only test `node IDs`.
See example in this project `tests/resources/exclusive_tests.txt`.

Placing the slowest tests in `exclusive_tests.txt` will give you the most benefit.

### Available Schedulers:
- `ExclusiveLoadScheduling` Schedule tests from `exclusive_tests.txt` first and on dedicated nodes.
- `ExclusiveLoadFileScheduling`: Place tests from `exclusive_tests.txt` to unique `scopes`.
Other tests are grouped as in `--dist loadfile`: tests from the same file run on the same node.
- `ExclusiveLoadScopeScheduling`: Schedule tests from `exclusive_tests.txt` first and on dedicated nodes. 
Other tests are grouped as in `--dist loadfile`: tests from the same file run on the same node.


# Developers
Do not forget to run `. ./activate.sh`.

To see how tests were scheduled use something like

    python -m pytest -n 4 --xdist-report -s

# Scripts
    make help

## Coverage report
* [Codecov](https://app.codecov.io/gh/andgineer/xdist-scheduling-exclusive/tree/main/src%2Fxdist_scheduling_exclusive)
* [Coveralls](https://coveralls.io/github/andgineer/xdist-scheduling-exclusive)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "xdist-scheduling-exclusive",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "log,log-handler,opensearch",
    "author": "",
    "author_email": "Andrey Sorokin <andrey@sorokin.engineer>",
    "download_url": "https://files.pythonhosted.org/packages/0f/1e/c27300db7359387f3c5047a4f5039937d26ea829fc197730265a4025f334/xdist_scheduling_exclusive-1.2.0.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://github.com/andgineer/xdist-scheduling-exclusive/workflows/CI/badge.svg)](https://github.com/andgineer/xdist-scheduling-exclusive/actions)\n[![Coverage](https://raw.githubusercontent.com/andgineer/xdist-scheduling-exclusive/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/andgineer/xdist-scheduling-exclusive/blob/python-coverage-comment-action-data/htmlcov/index.html)\n# xdist-scheduling-exclusive\n\npytest-xdist scheduler that runs some tests on dedicated workers. \n\nCan significantly improve runtime by running long tests on separate \nworkers.\n\nAlso in `conftest.py` you can find handy reporting capabilities to see how tests were scheduled.\n\n# Installation\n\n```bash\npip install xdist-scheduling-exclusive pytest-xdist\n```\n\n# Usage\n\nTo integrate with your pytest setup, update conftest.py as follows:\n\n```python\nfrom xdist_scheduling_exclusive import ExclusiveLoadScopeScheduling\n\ndef pytest_xdist_make_scheduler(config, log):\n    \"\"\"xdist-pytest hook to set scheduler.\"\"\"\n    return ExclusiveLoadScopeScheduling(config, log)\n```\n\nAnd place exclusive tests file `exclusive_tests.txt` in `tests/resources/`.\n\nYou can get the list with pytest's\n[--durations](https://docs.pytest.org/en/latest/how-to/usage.html#profiling-test-execution-duration)\noption that also sort tests by execution time. \nDo not forget to clear execution time from the file - there should be only test `node IDs`.\nSee example in this project `tests/resources/exclusive_tests.txt`.\n\nPlacing the slowest tests in `exclusive_tests.txt` will give you the most benefit.\n\n### Available Schedulers:\n- `ExclusiveLoadScheduling` Schedule tests from `exclusive_tests.txt` first and on dedicated nodes.\n- `ExclusiveLoadFileScheduling`: Place tests from `exclusive_tests.txt` to unique `scopes`.\nOther tests are grouped as in `--dist loadfile`: tests from the same file run on the same node.\n- `ExclusiveLoadScopeScheduling`: Schedule tests from `exclusive_tests.txt` first and on dedicated nodes. \nOther tests are grouped as in `--dist loadfile`: tests from the same file run on the same node.\n\n\n# Developers\nDo not forget to run `. ./activate.sh`.\n\nTo see how tests were scheduled use something like\n\n    python -m pytest -n 4 --xdist-report -s\n\n# Scripts\n    make help\n\n## Coverage report\n* [Codecov](https://app.codecov.io/gh/andgineer/xdist-scheduling-exclusive/tree/main/src%2Fxdist_scheduling_exclusive)\n* [Coveralls](https://coveralls.io/github/andgineer/xdist-scheduling-exclusive)\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2021 Andrey Sorokin <andrey@sorokin.engineer>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "pytest-xdist scheduler that runs some tests on dedicated workers. can significantly improve runtime by running long tests on separate workers.",
    "version": "1.2.0",
    "project_urls": {
        "Documentation": "https://andgineer.github.io/xdist-scheduling-exclusive/",
        "Homepage": "https://andgineer.github.io/xdist-scheduling-exclusive/"
    },
    "split_keywords": [
        "log",
        "log-handler",
        "opensearch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a5bcfd41de76e4849a60169326602ddb9784d40b2433ebe65e74390ef6357ca",
                "md5": "3aacc47ac519aab1f37be924453dcd01",
                "sha256": "125964295434615b42307661dba06442ffa520685ab7b286709c3989630a1f4c"
            },
            "downloads": -1,
            "filename": "xdist_scheduling_exclusive-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3aacc47ac519aab1f37be924453dcd01",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8762,
            "upload_time": "2024-03-09T08:12:06",
            "upload_time_iso_8601": "2024-03-09T08:12:06.112581Z",
            "url": "https://files.pythonhosted.org/packages/1a/5b/cfd41de76e4849a60169326602ddb9784d40b2433ebe65e74390ef6357ca/xdist_scheduling_exclusive-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f1ec27300db7359387f3c5047a4f5039937d26ea829fc197730265a4025f334",
                "md5": "2ac0ac3a11ea45ae4512bb7e5cdde4b1",
                "sha256": "4ae4f1a1556ba79abda730d12863953298f82f15287af65afd4a459669398cf7"
            },
            "downloads": -1,
            "filename": "xdist_scheduling_exclusive-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2ac0ac3a11ea45ae4512bb7e5cdde4b1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15025,
            "upload_time": "2024-03-09T08:12:07",
            "upload_time_iso_8601": "2024-03-09T08:12:07.686967Z",
            "url": "https://files.pythonhosted.org/packages/0f/1e/c27300db7359387f3c5047a4f5039937d26ea829fc197730265a4025f334/xdist_scheduling_exclusive-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-09 08:12:07",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "xdist-scheduling-exclusive"
}
        
Elapsed time: 0.22558s