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

Fix runner to string inconsistency #575

Merged
merged 3 commits into from
Mar 27, 2020
Merged

Fix runner to string inconsistency #575

merged 3 commits into from
Mar 27, 2020

Conversation

mrzzy
Copy link
Collaborator

@mrzzy mrzzy commented Mar 27, 2020

What this PR does / why we need it:

  • Fixes the inconsistency of converting Runner to string when assigning to Job.runner by converting all to use Runner.name().
  • Changes Runner.toString() to return a human readable string.
  • Changes all uses of Runner.getName() for all non Job.runner applications (ie logging, config file) to use Runner.toString()
  • Removes Runner.getName()

This is necessary to standardise the use of Runner.name() when
passing to the Job.runner, so that code depending on Job.runner
would know what to expect.

Which issue(s) this PR fixes:

Fixes #574

Does this PR introduce a user-facing change?:

NONE

Zhu Zhanyan added 2 commits March 27, 2020 10:17
…ner in DataflowJobManager

This is necessary to standardise the use of Runner.toString() when
passing to the Job.runner, so that code dependending on Job.runner
would know what to expect.
@feast-ci-bot
Copy link
Collaborator

Hi @mrzzy. Thanks for your PR.

I'm waiting for a gojek member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@zhilingc
Copy link
Collaborator

/lgtm

@zhilingc
Copy link
Collaborator

/approve

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrzzy, zhilingc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Use toString() to render human readable strings while using the
non overriding name() for code dependencies.
@mrzzy mrzzy requested a review from pradithya March 27, 2020 04:21
@ches ches added the backport-candidate Changes that may be desired for backport to earlier Feast release tracks label Mar 27, 2020
@woop
Copy link
Member

woop commented Mar 27, 2020

/ok-to-test

@pradithya
Copy link
Collaborator

/lgtm

@feast-ci-bot feast-ci-bot merged commit 901e260 into feast-dev:master Mar 27, 2020
@mrzzy mrzzy deleted the fix-runner-to-string-inconsistency branch March 27, 2020 06:03
@mrzzy
Copy link
Collaborator Author

mrzzy commented Apr 7, 2020

If backporting, please note that this PR introduced a bug that is fixed in PR #578

khorshuheng pushed a commit to khorshuheng/feast that referenced this pull request Apr 15, 2020
* Changed Runner.getName() to Runner.toString() when passing to Job.runner in DataflowJobManager

This is necessary to standardise the use of Runner.toString() when
passing to the Job.runner, so that code dependending on Job.runner
would know what to expect.

* Document how & when Runner.toString() or Runner.getName() should be used

* Convert getName() to toString(). Use name() for Job.runner.

Use toString() to render human readable strings while using the
non overriding name() for code dependencies.

Co-authored-by: Zhu Zhanyan <zhu.zhanyan@gojek.com>
khorshuheng pushed a commit that referenced this pull request Apr 15, 2020
* Changed Runner.getName() to Runner.toString() when passing to Job.runner in DataflowJobManager

This is necessary to standardise the use of Runner.toString() when
passing to the Job.runner, so that code dependending on Job.runner
would know what to expect.

* Document how & when Runner.toString() or Runner.getName() should be used

* Convert getName() to toString(). Use name() for Job.runner.

Use toString() to render human readable strings while using the
non overriding name() for code dependencies.

Co-authored-by: Zhu Zhanyan <zhu.zhanyan@gojek.com>
@ches ches mentioned this pull request Apr 25, 2020
ches added a commit to agoda-com/feast that referenced this pull request Apr 26, 2020
feast-dev#575 sought to clear up inconsistencies between uses of `Runner#name()`
(the standard final method of `java.lang.Enum` that returns the value's
enum constant name) and the riskily-named `Runner#getName()` defined in
Feast for human-readable Beam Runner names.

The latter is used as runner name users can set in config. The former
is used for values of the runner column of the jobs table in SQL (as it
should be). But it relied on careful coding to use the right one when
constructing `Job` instances. This is error prone, as feast-dev#578 demonstrates.

There is a more robust way: use the enum instead of stringly-typed
programming. It's one of the reasons we have enums :-)

This also renames the internal identifier in the Runner definition to
`humanName`, to distinguish it further from `Enum#name()`.
feast-ci-bot pushed a commit that referenced this pull request Apr 27, 2020
#575 sought to clear up inconsistencies between uses of `Runner#name()`
(the standard final method of `java.lang.Enum` that returns the value's
enum constant name) and the riskily-named `Runner#getName()` defined in
Feast for human-readable Beam Runner names.

The latter is used as runner name users can set in config. The former
is used for values of the runner column of the jobs table in SQL (as it
should be). But it relied on careful coding to use the right one when
constructing `Job` instances. This is error prone, as #578 demonstrates.

There is a more robust way: use the enum instead of stringly-typed
programming. It's one of the reasons we have enums :-)

This also renames the internal identifier in the Runner definition to
`humanName`, to distinguish it further from `Enum#name()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved backport-candidate Changes that may be desired for backport to earlier Feast release tracks kind/housekeeping lgtm ok-to-test size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Converting Runner to String for assigning to Job.Runner is inconsistent.
6 participants