Skip to content
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

Merged
merged 1 commit into from Mar 12, 2020

Conversation

rohdesamuel
Copy link
Contributor

@rohdesamuel rohdesamuel commented Feb 28, 2020

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:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@rohdesamuel rohdesamuel changed the title Streamingcache merge [BEAM-8335] Modify the StreamingCache to subclass the CacheManager Feb 28, 2020
@rohdesamuel rohdesamuel force-pushed the streamingcache_merge branch 3 times, most recently from 514c276 to 62cb7a9 Compare March 3, 2020 00:29
@rohdesamuel rohdesamuel marked this pull request as ready for review March 3, 2020 00:30
@rohdesamuel
Copy link
Contributor Author

R: @robertwb

Copy link
Contributor

@robertwb robertwb left a 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/direct/direct_runner.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/runners/direct/direct_runner.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/options/pipeline_options.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/runners/direct/clock.py Outdated Show resolved Hide resolved
# Always read at least once to read the whole file.
while True:
pos = fh.tell()
line = fh.readline()
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was not fixed.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@robertwb
Copy link
Contributor

robertwb commented Mar 5, 2020

Restest this please

@rohdesamuel rohdesamuel force-pushed the streamingcache_merge branch 3 times, most recently from 6d65928 to 67097b0 Compare March 6, 2020 19:16
sdks/python/apache_beam/runners/direct/test_stream_impl.py Outdated Show resolved Hide resolved
# Always read at least once to read the whole file.
while True:
pos = fh.tell()
line = fh.readline()
Copy link
Contributor

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.

sdks/python/apache_beam/runners/direct/direct_runner.py Outdated Show resolved Hide resolved
Copy link
Contributor

@robertwb robertwb left a 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.)

sdks/python/apache_beam/runners/direct/test_stream_impl.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/runners/direct/direct_runner.py Outdated Show resolved Hide resolved
# Always read at least once to read the whole file.
while True:
pos = fh.tell()
line = fh.readline()
Copy link
Contributor

Choose a reason for hiding this comment

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

This was not fixed.

@pabloem
Copy link
Member

pabloem commented Mar 10, 2020

retest this please

1 similar comment
@pabloem
Copy link
Member

pabloem commented Mar 10, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

1 similar comment
@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

# Always read at least once to read the whole file.
while True:
pos = fh.tell()
line = fh.readline()
Copy link
Member

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.

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

3 similar comments
@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

Run Python PreCommit

2 similar comments
@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

Run Python PreCommit

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

Run Python PreCommit

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

1 similar comment
@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

Run Python PreCommit

Change-Id: Ib61aa3fac53d9109178744e11eeebe5c5da0929c
@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

4 similar comments
@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 11, 2020

retest this please

@pabloem
Copy link
Member

pabloem commented Mar 12, 2020

Merging as Robert's last comment was addressed by re-reading from the previous postion.

@pabloem pabloem merged commit bb9826c into apache:master Mar 12, 2020
@aaltay
Copy link
Member

aaltay commented Mar 19, 2020

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.

@aaltay
Copy link
Member

aaltay commented Mar 19, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants