flat-zoo-31952
01/10/2022, 7:35 PM./pants dependees --transitive some/file.py | xargs ./pants filter --target-type=python_tests --granularity=file
If I run this once, it takes a while to compute, which I expect. But, on subsequent tries it looks like Pants usually needs to completely recompute the depedency graph every time I run it. (Well, using -ldebug
shows that it's hitting cache for each module but it just takes a while to traverse the whole graph, even if it's using cache each time). My question is... why doesn't it just remember the final output of that recent ./pants dependees
command? Does this have something to do with pantsd?witty-crayon-22786
01/10/2022, 8:14 PMflat-zoo-31952
01/10/2022, 8:42 PMflat-zoo-31952
01/10/2022, 8:43 PMwitty-crayon-22786
01/10/2022, 8:45 PMwitty-crayon-22786
01/10/2022, 8:46 PMwitty-crayon-22786
01/10/2022, 8:46 PMwitty-crayon-22786
01/10/2022, 8:47 PMInitializing scheduler
line…?flat-zoo-31952
01/10/2022, 8:48 PMwitty-crayon-22786
01/10/2022, 8:48 PMflat-zoo-31952
01/10/2022, 8:54 PMwitty-crayon-22786
01/10/2022, 8:54 PMwitty-crayon-22786
01/10/2022, 8:55 PM.pants.d/pants.log
? pantsd
could be restartingwitty-crayon-22786
01/10/2022, 8:56 PMInitializing scheduler..
indicates that pantsd
restarted, whereas *: reinitializing scheduler
indicates that options changedflat-zoo-31952
01/10/2022, 8:56 PMwitty-crayon-22786
01/10/2022, 8:57 PMflat-zoo-31952
01/10/2022, 8:59 PM15:55:08.28 [WARN] Completed: Find Python interpreter to bootstrap PEX - No bootstrap Python executable could be found from the option `interpreter_search_paths` in the `[python-setup]` scope. Will attempt to run PEXes directly.
15:55:16.62 [ERROR] The scheduler was invalidated: Exception('pantsd process 433454 was using 1026.92 MiB of memory (above the `--pantsd-max-memory-usage` limit of 1024.00 MiB).')
15:55:17.19 [ERROR] service failure for <pants.pantsd.service.scheduler_service.SchedulerService object at 0x7ef308554ee0>.
15:55:17.20 [INFO] Waiting for ongoing runs to complete before exiting...
flat-zoo-31952
01/10/2022, 9:00 PMflat-zoo-31952
01/10/2022, 9:02 PMwitty-crayon-22786
01/10/2022, 9:03 PMdependees
+ filter
…witty-crayon-22786
01/10/2022, 9:04 PMflat-zoo-31952
01/10/2022, 9:06 PMflat-zoo-31952
01/10/2022, 9:34 PMflat-zoo-31952
01/10/2022, 9:39 PMwitty-crayon-22786
01/10/2022, 9:46 PMflat-zoo-31952
01/10/2022, 9:47 PMflat-zoo-31952
01/10/2022, 9:48 PMflat-zoo-31952
01/10/2022, 9:49 PMwitty-crayon-22786
01/10/2022, 9:51 PM$ time ./pants list :: | xargs ./pants filter --target-type=python_tests | wc -l
131
real 0m3.786s
user 0m0.416s
sys 0m0.442s
$ time ./pants list :: | wc -l
1412
real 0m0.788s
user 0m0.162s
sys 0m0.208s
witty-crayon-22786
01/10/2022, 9:52 PMwitty-crayon-22786
01/10/2022, 9:52 PMdependees
is relatively expensive (it fully computes dependencies), but still shouldn’t take that longwitty-crayon-22786
01/10/2022, 9:52 PMflat-zoo-31952
01/10/2022, 9:53 PMflat-zoo-31952
01/10/2022, 9:56 PMflat-zoo-31952
01/10/2022, 9:57 PM❯ wc -l magic-deps.txt
1623 magic-deps.txt
❯ ./pants --spec-files=(tail -n 100 magic-deps.txt | psub) filter --target-type=python_tests --granularity=file
...
This is enough to get the cache to stop working and pantsd looks like it gets slower an consumes more memory with each executionwitty-crayon-22786
01/10/2022, 10:00 PMreinitializing
line…?witty-crayon-22786
01/10/2022, 10:00 PM--spec-files
option is potentially relevant, although it is not supposed to invalidateflat-zoo-31952
01/10/2022, 10:01 PMflat-zoo-31952
01/10/2022, 10:18 PM./pants filter --target_type=python_tests $target_that_is_not_a_test
After this, there seems to be a memory leak in pantsd and performance of the dependency graph computation is not pulled from cache and gets slower with each execution. Can be fixed by killing pantsdwitty-crayon-22786
01/10/2022, 10:41 PM-ldebug
output of running filter
repeatedly, that would be helpful. there were some minor fixes in this area, and i’m wondering if they’re relevant. but it’s still unexpected 1) to use that much memory, 2) for things to get slower over timeflat-zoo-31952
01/11/2022, 12:28 AMflat-zoo-31952
01/12/2022, 6:08 PMflat-zoo-31952
01/12/2022, 6:08 PMwitty-crayon-22786
01/12/2022, 6:53 PM