Skip to content

Simplify code around --stats-json-file#11432

Closed
gshuflin wants to merge 4 commits into
pantsbuild:masterfrom
gshuflin:simplify-store-stats
Closed

Simplify code around --stats-json-file#11432
gshuflin wants to merge 4 commits into
pantsbuild:masterfrom
gshuflin:simplify-store-stats

Conversation

@gshuflin
Copy link
Copy Markdown
Contributor

@gshuflin gshuflin commented Jan 8, 2021

Simplify the code paths around how RunTracker handles the --stats-json-file option and add a test for it.

[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
And add a test for it.

[ci skip-build-wheels]
@gshuflin
Copy link
Copy Markdown
Contributor Author

gshuflin commented Jan 8, 2021

This is based on #11431


def test_stats_json_write() -> None:
with freeze_time(datetime.datetime(2020, 1, 1, 12, 0, 0)) as frozen_time:
with temporary_dir() as tmpdir:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


contents = open(json_file).read()
json_contents = json.loads(contents)
for key in ["run_info", "pantsd_stats", "cumulative_timings", "recorded_options"]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asset set(json_contents.keys()) == {"run_info", "pantsd_stats", "cumulative_timings", "recorded_options"}

@asherf
Copy link
Copy Markdown
Member

asherf commented Jan 8, 2021

I think we should remove the ability to write to a json file. I don't see a use for it.

@gshuflin gshuflin closed this Jan 9, 2021
@gshuflin gshuflin deleted the simplify-store-stats branch January 11, 2021 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants