Skip to content

More transforms#63

Merged
johan-bjareholt merged 4 commits intomasterfrom
dev/transform/more_transforms
Jun 24, 2018
Merged

More transforms#63
johan-bjareholt merged 4 commits intomasterfrom
dev/transform/more_transforms

Conversation

@johan-bjareholt
Copy link
Copy Markdown
Member

With chunk_events_by_key we can finally remove the chunking in aw-webui for the timeline

  • chunk_events_by_key
  • sum_durations

@ghost ghost assigned johan-bjareholt Jun 20, 2018
@ghost ghost added the review label Jun 20, 2018
@johan-bjareholt johan-bjareholt changed the title Dev/transform/more transforms More transforms Jun 20, 2018
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jun 20, 2018

Codecov Report

Merging #63 into master will decrease coverage by 0.12%.
The diff coverage is 94.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #63      +/-   ##
==========================================
- Coverage   95.81%   95.69%   -0.13%     
==========================================
  Files          30       31       +1     
  Lines        1243     1278      +35     
  Branches      196      204       +8     
==========================================
+ Hits         1191     1223      +32     
- Misses         23       24       +1     
- Partials       29       31       +2
Impacted Files Coverage Δ
aw_transform/__init__.py 100% <100%> (ø) ⬆️
aw_analysis/query2_functions.py 88.7% <100%> (+0.11%) ⬆️
aw_transform/sort_by.py 92.3% <100%> (+1.39%) ⬆️
aw_transform/chunk_events_by_key.py 90.47% <90.47%> (ø)
aw_transform/filter_keyvals.py 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e387e9...59e6912. Read the comment docs.

for event in events:
if key not in event.data:
pass
elif len(chunked_events) == 0 or chunked_events[-1].data[key] != event.data[key]:
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.

One thing that always confused me about chunking before, and still does, is how it results in the timeline not showing any eventual gap between two events with the same chunk-key. Could we do anything about that?

Maybe add a pulsetime-like argument that doesn't chunk events if separated by a significant time?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, will fix

def sum_durations(events) -> timedelta:
s = timedelta()
for event in events:
s += event.duration
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.

Could be done simply like: return sum(event.duration for event in events) if events else timedelta()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since the function should always return a timedelta I wrote:

timedelta(seconds=(sum(event.duration.total_seconds() for event in events)))

Copy link
Copy Markdown
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@johan-bjareholt johan-bjareholt merged commit ed4060d into master Jun 24, 2018
@ghost ghost removed the review label Jun 24, 2018
@johan-bjareholt johan-bjareholt deleted the dev/transform/more_transforms branch June 24, 2018 20:40
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.

3 participants