rapid-exabyte-76685
03/30/2022, 5:09 AMtest
runs with (ideally to 1, since I have problems with tests running in parallel that I will solve in the medium-term, but not in the short-term)fast-nail-55400
03/30/2022, 5:15 AM--process-execution-local-parallelism
might be usefulrapid-exabyte-76685
03/30/2022, 5:20 AM./pants test --debug ::
also works, but doesn't process the same summary output that ./pants test ::
does. I'll give this a gorapid-exabyte-76685
03/30/2022, 5:20 AM./pants --process-execution-local-parallelism=1 test
gives me the nice summary outputrapid-exabyte-76685
03/30/2022, 5:27 AMrapid-exabyte-76685
03/30/2022, 5:52 AMhappy-kitchen-89482
03/30/2022, 5:55 PMhappy-kitchen-89482
03/30/2022, 5:55 PMrapid-exabyte-76685
03/31/2022, 7:20 AMpants test
with appropriate combinations of the --tag
filter and the --process-execution-local-parallelism=1
parameter?rapid-exabyte-76685
03/31/2022, 7:20 AMrapid-exabyte-76685
03/31/2022, 7:22 AMpython_tests(
name="tests",
overrides={
"test_a.py": {"tags": ["run_serially"]),
"test_b.py": {"tags": ["run_serially"]),
# And the above can be expressed as?...
("test_a.py", "test_b.py"): {
"tags": ["run_serially"]
},
}
)
rapid-exabyte-76685
03/31/2022, 7:23 AM./pants --tag='-run_serially' test ::
but I still see test_a.py
and test_b.py
running and therefore blocking completion due to their race conditionrapid-exabyte-76685
03/31/2022, 7:26 AM--tag='+run_serially'
and being told no files or targets specified, so maybe I'm not applying the tag correctlyrapid-exabyte-76685
03/31/2022, 7:38 AM--tag='run_serially'
example
I'm finding that I can ./pants --tag='sometag' test ::
to include only tests WITH the tag, but ./pants --tag='-sometag' test ::
to EXCLUDE tests with the tag is not working, and there are still being included.rapid-exabyte-76685
03/31/2022, 7:42 AMrapid-exabyte-76685
03/31/2022, 7:43 AM::
which is an address spec? not a file address? 🤷rapid-exabyte-76685
03/31/2022, 10:00 AM+tag
and -tag
work for list
but only +tag
works for test
happy-kitchen-89482
03/31/2022, 3:16 PMlist
and for test
. Weird.happy-kitchen-89482
03/31/2022, 3:16 PMhappy-kitchen-89482
03/31/2022, 3:19 PMhappy-kitchen-89482
03/31/2022, 3:21 PMhappy-kitchen-89482
03/31/2022, 8:37 PMhappy-kitchen-89482
03/31/2022, 8:37 PMrapid-exabyte-76685
03/31/2022, 8:54 PMhappy-kitchen-89482
03/31/2022, 9:32 PMhappy-kitchen-89482
03/31/2022, 9:32 PMrapid-exabyte-76685
03/31/2022, 9:52 PMpython_tests
targets in the relevant directory and including/excluding via sources
directly?witty-crayon-22786
03/31/2022, 9:56 PMwitty-crayon-22786
03/31/2022, 9:57 PMwitty-crayon-22786
03/31/2022, 11:08 PMexecution_slot_var
setting make sense for your usecase? we haven’t done a great job of explaining itrapid-exabyte-76685
03/31/2022, 11:32 PMpants.toml
has...
[pytest]
PANTS_PYTEST_EXECUTION_SLOT_VAR = "MY_SLOT_VAR"
... then the test code could do ...
os.environ['MY_SLOT_VAR']
and it would get a value between 0-3 (or 1-4?) depending on which core/slot it is running in?witty-crayon-22786
03/31/2022, 11:33 PMwitty-crayon-22786
03/31/2022, 11:33 PMdrop $database
(or the non-SQL equivalent) and recreaterapid-exabyte-76685
03/31/2022, 11:34 PMdatabase_0
through database_3
- where the setup is running outside of pantswitty-crayon-22786
03/31/2022, 11:35 PM--process-execution-local-parallelism
, yea. but if it’s possible to run the setup inside tests, that might be more self containedwitty-crayon-22786
03/31/2022, 11:36 PMyou can by querying the computed value ofwhich you can do with something like--process-execution-local-parallelism
./pants help-all | jq …
rapid-exabyte-76685
03/31/2022, 11:46 PMwitty-crayon-22786
03/31/2022, 11:48 PMwitty-crayon-22786
03/31/2022, 11:49 PMrapid-exabyte-76685
04/01/2022, 1:09 AMrapid-exabyte-76685
04/01/2022, 1:11 AMwhich you can do with something likeI think this is what I want?./pants help-all | jq …
./pants help-all | jq -r '.scope_to_help_info ."" .advanced[] | select (.env_var == "PANTS_PROCESS_EXECUTION_LOCAL_PARALLELISM") .value_history .ranked_values[] | select (.rank == "HARDCODED") .value'
rapid-exabyte-76685
04/01/2022, 1:11 AMrapid-exabyte-76685
04/01/2022, 1:16 AMHARDCODED
gives me pause but it looks to return the correct core count across two different machines... although on my M1 Pro MacBook, which has 8 performance cores and 2 efficiency cores, it returns 10.rapid-exabyte-76685
04/01/2022, 1:28 AMwitty-crayon-22786
04/01/2022, 3:20 AMeager-dress-66405
04/08/2022, 6:27 AMpython_tests
overrides
to apply tags and use the following in CI to run just the select tests. Same could work with xargs -0
. Critical part that I don't see mentioned was the --granularity=file
arg on filter, which without will end up including the entire expansion of python_tests
in that directory.
readarray -d '' targets < <(./pants \
--tag=-skip_ci \
--changed-dependees=transitive \
--changed-since="$PANTS_CHANGED_SINCE_REF" \
filter \
--sep="\0" \
--granularity=file)
./pants test "${targets[@]}"
eager-dress-66405
04/14/2022, 10:02 PM