-
Notifications
You must be signed in to change notification settings - Fork 7.2k
[Data] Added tracking of block serialization time #60574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexeykudinkin
wants to merge
19
commits into
master
Choose a base branch
from
ak/serde-mtrcs-add
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+199
−48
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d93bc3d
Wired in serialization duration tracking into Ray Core generator
alexeykudinkin 89942ca
Added wiring of serialization duration into async gen unrolling
alexeykudinkin e392681
Fixed `udf_time` to be properly reset per block
alexeykudinkin 6fa647e
Properly track block serialization time in `MapOperator`
alexeykudinkin 34ef64f
Properly track block serialization time in HashShuffle Op base class
alexeykudinkin fababc1
Added `block_serialization_time_s`;
alexeykudinkin 5cb8233
Updated tests
alexeykudinkin d5bd5f7
Tidying up
alexeykudinkin 4d34d0e
Added text to verify `task_completion_time_excl_backpressure_s` inclu…
alexeykudinkin b0119af
Updating tests
alexeykudinkin e1a196d
Fixed tests
alexeykudinkin 35aa1c8
`lint`
alexeykudinkin fa5eb26
Fixed reset param handling
alexeykudinkin db9956b
Made `obj_store_mem_pending_task_outputs` metric property
alexeykudinkin ef96658
Fixed tests
alexeykudinkin fcd78b6
Added `_StreamingGeneratorStats`
alexeykudinkin 8cf9a5b
Updated usages
alexeykudinkin 9d1aa20
Tidying up
alexeykudinkin deb1036
Fixed potential NPEs
alexeykudinkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import itertools | ||
| import logging | ||
| from abc import ABC, abstractmethod | ||
| from dataclasses import replace | ||
| from typing import ( | ||
| TYPE_CHECKING, | ||
| Any, | ||
|
|
@@ -21,7 +22,7 @@ | |
|
|
||
| import ray | ||
| from ray import ObjectRef | ||
| from ray._raylet import ObjectRefGenerator | ||
| from ray._raylet import ObjectRefGenerator, StreamingGeneratorStats | ||
| from ray.data._internal.compute import ( | ||
| ActorPoolStrategy, | ||
| ComputeStrategy, | ||
|
|
@@ -746,7 +747,9 @@ def _map_task( | |
| ) | ||
| DataContext._set_current(data_context) | ||
| ctx.kwargs.update(kwargs) | ||
|
|
||
| TaskContext.set_current(ctx) | ||
|
|
||
| stats = BlockExecStats.builder() | ||
| map_transformer.override_target_max_block_size(ctx.target_max_block_size_override) | ||
| block_iter: Iterable[Block] | ||
|
|
@@ -756,17 +759,26 @@ def _map_task( | |
| block_iter = iter(blocks) | ||
|
|
||
| with MemoryProfiler(data_context.memory_usage_poll_interval_s) as profiler: | ||
| for b_out in map_transformer.apply_transform(block_iter, ctx): | ||
| # TODO(Clark): Add input file propagation from input blocks. | ||
| m_out = BlockAccessor.for_block(b_out).get_metadata() | ||
| s_out = BlockAccessor.for_block(b_out).schema() | ||
| m_out.exec_stats = stats.build() | ||
| m_out.exec_stats.udf_time_s = map_transformer.udf_time() | ||
| m_out.exec_stats.task_idx = ctx.task_idx | ||
| m_out.exec_stats.max_uss_bytes = profiler.estimate_max_uss() | ||
| meta_with_schema = BlockMetadataWithSchema(metadata=m_out, schema=s_out) | ||
| yield b_out | ||
| yield meta_with_schema | ||
| for block in map_transformer.apply_transform(block_iter, ctx): | ||
| block_meta = BlockAccessor.for_block(block).get_metadata() | ||
| block_schema = BlockAccessor.for_block(block).schema() | ||
|
|
||
| # Derive block execution stats | ||
| exec_stats = stats.build() | ||
| # Yield block and retrieve its Ray object serialization timing | ||
| stats: StreamingGeneratorStats = yield block | ||
| if stats: | ||
| exec_stats.block_ser_time_s = stats.object_creation_dur_s | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when operators are fused, can we assert in that test this value is 0? |
||
|
|
||
| exec_stats.udf_time_s = map_transformer.udf_time_s(reset=True) | ||
| exec_stats.task_idx = ctx.task_idx | ||
| exec_stats.max_uss_bytes = profiler.estimate_max_uss() | ||
|
|
||
| yield BlockMetadataWithSchema( | ||
| metadata=replace(block_meta, exec_stats=exec_stats), schema=block_schema | ||
| ) | ||
|
|
||
| # Reset trackers | ||
| stats = BlockExecStats.builder() | ||
| profiler.reset() | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -160,7 +160,7 @@ def __init__( | |
| self._transform_fns = [] | ||
| self._init_fn = init_fn if init_fn is not None else lambda: None | ||
| self._output_block_size_option_override = output_block_size_option_override | ||
| self._udf_time = 0 | ||
| self._udf_time_s = 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Maybe a type var to denote secs? |
||
|
|
||
| # Add transformations | ||
| self.add_transform_fns(transform_fns) | ||
|
|
@@ -202,7 +202,7 @@ def _udf_timed_iter( | |
| try: | ||
| start = time.perf_counter() | ||
| output = next(input) | ||
| self._udf_time += time.perf_counter() - start | ||
| self._udf_time_s += time.perf_counter() - start | ||
| yield output | ||
| except StopIteration: | ||
| break | ||
|
|
@@ -274,8 +274,11 @@ def _combine_transformations( | |
| ) -> list[Any]: | ||
| return ones + others | ||
|
|
||
| def udf_time(self) -> float: | ||
| return self._udf_time | ||
| def udf_time_s(self, reset: bool) -> float: | ||
| cur_time_s = self._udf_time_s | ||
| if reset: | ||
| self._udf_time_s = 0 | ||
| return cur_time_s | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| # Below are subclasses of MapTransformFn. | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to
object_serialization_time_s