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

Update core.py [If funnction do not return any thing then warning will be pop up] #28680

Closed
wants to merge 1 commit into from

Conversation

saikethan27
Copy link

@saikethan27 saikethan27 commented Sep 27, 2023

If self.fn.process does not return anything [None] then warning will be popped as

_LOGGER.warning(
          no iterator is returned by the process method in DoFn)

where changes are committed in function _check_fn_use_yield_and_return to check if yield or return any one is present in code

this Issue is related to #28061


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • 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.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

If "process" fun returns not return any thing then warning will be pop up
@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #28680 (95833a6) into master (7d78572) will increase coverage by 0.00%.
Report is 3 commits behind head on master.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master   #28680   +/-   ##
=======================================
  Coverage   71.96%   71.97%           
=======================================
  Files         680      680           
  Lines      100163   100171    +8     
=======================================
+ Hits        72087    72094    +7     
- Misses      26498    26499    +1     
  Partials     1578     1578           
Flag Coverage Δ
python 82.54% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
sdks/python/apache_beam/transforms/core.py 91.49% <100.00%> (+0.04%) ⬆️

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@saikethan27
Copy link
Author

assign set of reviewers

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @jrmccluskey for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Comment on lines +1495 to +1499
elif _check_fn_use_yield_and_return(self.fn.process) is None:
_LOGGER.warning(
'no iterator is returned by the process method in %s',
self.fn.__class__)

Copy link
Contributor

Choose a reason for hiding this comment

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

Mechanically you probably don't want to re-run _check_fn_use_yield_and_return() here. Consider capturing the output value the first time and using that here instead

for line in source_code.split("\n"):
if line.lstrip().startswith("yield ") or line.lstrip().startswith(
"yield("):
has_yield = True
if line.lstrip().startswith("return ") or line.lstrip().startswith(
"return("):
has_return = True
if line.lstrip().startswith("return None"):
Copy link
Contributor

Choose a reason for hiding this comment

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

The warn could also be placed here instead, eliminating the need for the elif block.

Comment on lines +1426 to +1427
if len(source_code)==0:
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this check?

@damccorm
Copy link
Contributor

I think this is trying to do the same thing as #28159 which was opened first and seems slightly more complete, so I think we should proceed with that one and I'm going to close this pull request.

In general, please make sure that you are assigned to an issue before you start working on it to avoid duplicate work. If someone else is assigned but you're not sure if they're working on the problem, its usually best to ask first.

@damccorm damccorm closed this Oct 27, 2023
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.

3 participants