forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove aggregated timings (pantsbuild#11431)
This commit removes the last vestigial use of the `aggregated_timings` module from `RunTracker` and deletes the module. The `get_cumulative_timings` method has been modified to return the same JSON that would've been returned via the `aggregated_timings` mechanism. We will keep this around for backwards compatibility for the time being, but will likely implement a new API for getting timing data from `RunTracker` soon. This commit also adds a unit test for `RunTracker`.
- Loading branch information
Showing
7 changed files
with
43 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
python_library() | ||
python_tests( | ||
name='tests' | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
import datetime | ||
import time | ||
|
||
from freezegun import freeze_time | ||
|
||
from pants.base.exiter import PANTS_SUCCEEDED_EXIT_CODE | ||
from pants.goal.run_tracker import RunTracker | ||
from pants.testutil.option_util import create_options_bootstrapper | ||
from pants.util.contextutil import environment_as, temporary_dir | ||
|
||
|
||
@freeze_time(datetime.datetime(2020, 1, 1, 12, 0, 0), as_kwarg="frozen_time") | ||
def test_run_tracker_timing_output(**kwargs) -> None: | ||
with temporary_dir() as buildroot: | ||
with environment_as(PANTS_BUILDROOT_OVERRIDE=buildroot): | ||
run_tracker = RunTracker(create_options_bootstrapper([]).bootstrap_options) | ||
run_tracker.start(run_start_time=time.time()) | ||
frozen_time = kwargs["frozen_time"] | ||
frozen_time.tick(delta=datetime.timedelta(seconds=1)) | ||
run_tracker.end_run(PANTS_SUCCEEDED_EXIT_CODE) | ||
|
||
timings = run_tracker.get_cumulative_timings() | ||
assert timings[0]["label"] == "main" | ||
assert timings[0]["timing"] == 1.0 |