[pantsd] Add RunTracker stats.#5374
Conversation
2995776 to
b8ada86
Compare
| self._replace_targets(target_roots) | ||
| self._invalidation_report = invalidation_report | ||
| # TODO(#4769): This should not be exposed to anyone. | ||
| # Note that the Context created in unit tests by BaseTest uses a different codepath. |
| return self._scm | ||
|
|
||
| @property | ||
| def scheduler(self): |
There was a problem hiding this comment.
If possible, it would be good not to expose this as a public-seeming API, and continue to access the private field (or to expose a method that closes over the entire "get the graph len and record it in the runtracker" operation). The goal of #4769 is to give Tasks the ability to request that things run in the scheduler in a declarative way. Having imperative access is supposed to just be a stopgap.
| self.resident_graph_size = None | ||
| self.resulting_graph_size = None | ||
|
|
||
| def set_resident_graph_size(self, size): |
There was a problem hiding this comment.
s/resident/already_resident/?
There was a problem hiding this comment.
renamed to preceding_graph_size
| return self._scm | ||
|
|
||
| @property | ||
| def scheduler(self): |
There was a problem hiding this comment.
If possible, it would be good not to expose this as a public-seeming API, and continue to access the private field (or to expose a method that closes over the entire "get the graph len and record it in the runtracker" operation). The goal of #4769 is to give Tasks the ability to request that things run in the scheduler in a declarative way. Having imperative access is supposed to just be a stopgap.
[omerta pants (kwlzn/pantsd_stats)]$ ./pants -q list : --run-tracker-stats-local-json-file=test.json >/dev/null; cat test.json | jq '.pantsd_stats'
{
"resident_graph_size": -1,
"resulting_graph_size": 81
}
[omerta pants (kwlzn/pantsd_stats)]$ PANTS_ENABLE_PANTSD=True ./pants -q list : --run-tracker-stats-local-json-file=test.json >/dev/null; cat test.json | jq '.pantsd_stats'
{
"resident_graph_size": 0,
"resulting_graph_size": 81
}
[omerta pants (kwlzn/pantsd_stats)]$ PANTS_ENABLE_PANTSD=True ./pants -q list : --run-tracker-stats-local-json-file=test.json >/dev/null; cat test.json | jq '.pantsd_stats'
{
"resident_graph_size": 15,
"resulting_graph_size": 81
}
[omerta pants (kwlzn/pantsd_stats)]$ PANTS_ENABLE_PANTSD=True ./pants -q list :: --run-tracker-stats-local-json-file=test.json >/dev/null; cat test.json | jq '.pantsd_stats'
{
"resident_graph_size": 15,
"resulting_graph_size": 14634
}
[omerta pants (kwlzn/pantsd_stats)]$ PANTS_ENABLE_PANTSD=True ./pants -q list :: --run-tracker-stats-local-json-file=test.json >/dev/null; cat test.json | jq '.pantsd_stats'
{
"resident_graph_size": 6198,
"resulting_graph_size": 14634
}
Fixes #4644
|
Leaving a note here for posterity: in order to cherry-pick this one, I needed to cherry-pick #5239 as well. |
Fixes #4644