Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
Signed-off-by: hongchaodeng <hongchaodeng1@gmail.com>
  • Loading branch information
hongchaodeng committed May 24, 2024
1 parent 5a6a88d commit 047b8e7
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions python/ray/tests/test_log_dedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_nodedup_logs_single_process():
assert out1 == [batch1]


def test_nodedup_logs_only_canonicalized_lines():
def test_nodedup_logs_buffer_only_lines():
now = 142300000.0

def gettime():
Expand All @@ -32,27 +32,46 @@ def gettime():
# numbers are canonicalised, so this would lead to empty dedup_key
"lines": ["1"],
}
batch2 = {
"ip": "node1",
"pid": 200,
"lines": ["2"],
}

# Immediately prints always.
out1 = dedup.deduplicate(batch1)
assert out1 == [batch1]

now += 1.0
# Should buffer duplicates.

# Should print new lines even if it is number only again
batch2 = {
"ip": "node2",
"pid": 200,
"lines": ["2"],
}
out2 = dedup.deduplicate(batch2)
assert out2 == [
{
"ip": "node1",
"ip": "node2",
"pid": 200,
"lines": ["2"],
}
]

now += 3.0

# Should print new lines even if it is same number
batch3 = {
"ip": "node3",
"pid": 300,
"lines": ["2"],
}
# Should buffer duplicates.
out3 = dedup.deduplicate(batch3)
assert out3 == [
{
"ip": "node3",
"pid": 300,
"lines": ["2"],
}
]


def test_dedup_logs_multiple_processes():
now = 142300000.0
Expand Down

0 comments on commit 047b8e7

Please sign in to comment.