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
[BEAM-8335] Modify the StreamingCache to subclass the CacheManager #11005
Conversation
514c276
to
62cb7a9
Compare
R: @robertwb |
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.
I just realized I started reviewing the full CL, not just that one commit.
sdks/python/apache_beam/runners/interactive/caching/streaming_cache.py
Outdated
Show resolved
Hide resolved
sdks/python/apache_beam/runners/interactive/caching/streaming_cache.py
Outdated
Show resolved
Hide resolved
# Always read at least once to read the whole file. | ||
while True: | ||
pos = fh.tell() | ||
line = fh.readline() |
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.
Is it possible for this to read part of a line? Perhaps the check should be whether it ends in a newline, otherwise you have to go back and try to read more.
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.
The Python API for the readline()
only allows for part of a line to be read if the optional parameter size
is given and is non-negative. So this is okay and will read the whole line.
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.
This only holds if the file is not being written to concurrently (just tried it out). Otherwise it may get to EOF half way through a line.
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.
This was not fixed.
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.
I think this is okay though. It's a bug if the file is being concurrently written to.
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.
We've discussed this. Sam will add the fix by re-reading from the initial position.
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.
Ah sorry, I misunderstood. I thought you were referring to multiple concurrent writers. I'll change the code to take this into account.
sdks/python/apache_beam/runners/interactive/caching/streaming_cache.py
Outdated
Show resolved
Hide resolved
3bc5d82
to
f41c34f
Compare
Restest this please |
6d65928
to
67097b0
Compare
# Always read at least once to read the whole file. | ||
while True: | ||
pos = fh.tell() | ||
line = fh.readline() |
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.
This only holds if the file is not being written to concurrently (just tried it out). Otherwise it may get to EOF half way through a line.
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.
Thanks. FWIW, it's easier to review if you don't force-push so I can see the edits from last time. (You can rebase to squash individual commits into a fewer number of commits.)
# Always read at least once to read the whole file. | ||
while True: | ||
pos = fh.tell() | ||
line = fh.readline() |
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.
This was not fixed.
7b05651
to
8ff7323
Compare
8ff7323
to
3f520ba
Compare
retest this please |
1 similar comment
retest this please |
3f520ba
to
7a6a4c6
Compare
retest this please |
1 similar comment
retest this please |
retest this please |
# Always read at least once to read the whole file. | ||
while True: | ||
pos = fh.tell() | ||
line = fh.readline() |
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.
We've discussed this. Sam will add the fix by re-reading from the initial position.
7a6a4c6
to
af68392
Compare
retest this please |
3 similar comments
retest this please |
retest this please |
retest this please |
Run Python PreCommit |
2 similar comments
Run Python PreCommit |
Run Python PreCommit |
af68392
to
3b38f88
Compare
retest this please |
1 similar comment
retest this please |
Run Python PreCommit |
Change-Id: Ib61aa3fac53d9109178744e11eeebe5c5da0929c
3b38f88
to
c69d409
Compare
retest this please |
4 similar comments
retest this please |
retest this please |
retest this please |
retest this please |
Merging as Robert's last comment was addressed by re-reading from the previous postion. |
I believe you need to add pathlib / pathlib2 to the setup.py. At least for py2. For python3 it might be part of the standard library. |
This turns out to be a non-issue, because ipython depends on pathlib2 and brings that to the environment. |
Modifies the StreamingCache to subclass the CacheManager. This allows for the overriding of the source and sink transforms.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.