Skip to content

Conversation

@kw2542
Copy link
Contributor

@kw2542 kw2542 commented Jan 10, 2020

Design:
https://cwiki.apache.org/confluence/display/SAMZA/SEP-23%3A+Simplify+Job+Runner

Changes:

  1. Depending on the existence of job.config.loader.factory, RemoteApplicationRunner will alternatively only submit the job, without planning.
  2. Late initialize RemoteJobPlanner only when needed to avoid executing user code in submitting only mode.

API Changes:
N/A. This is part of a series PRs, detailed information will be provided in the last/main PR.

Upgrade Instructions:
N/A. This is part of a series PRs, detailed information will be provided in the last/main PR.

Usage Instructions:
N/A. This is part of a series PRs, detailed information will be provided in the last/main PR.

Tests:
End to end tested with Hello Samza job.

Ke Wu added 2 commits January 10, 2020 10:52
Design:
https://cwiki.apache.org/confluence/display/SAMZA/SEP-23%3A+Simplify+Job+Runner

Changes:

1. Depending on the existence of job.config.loader.factory, RemoteApplicationRunner will alternatively only submit the job, without planning.
2. Late initialize RemoteJobPlanner only when needed to avoid executing user code in submitting only mode.

API Changes:
N/A. This is part of a series PRs, detailed information will be provided in the last/main PR.

Upgrade Instructions:
N/A. This is part of a series PRs, detailed information will be provided in the last/main PR.

Usage Instructions:
N/A. This is part of a series PRs, detailed information will be provided in the last/main PR.

Tests:
N/A
@bkonold
Copy link
Contributor

bkonold commented Jan 14, 2020

Change LGTM. Can you include a unit test for the behavior?

}

@Test
public void testRunWithConfigLoaderFactoryPresent() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. I guess the code as-is isn't very unit test friendly. It would be nice to test the invocation of .submit vs .run on JobRunner depending on the presence of the ConfigLoaderFactory.

Maybe we could factor out the JobRunner creation into its own method, and use a spy to stub out the return value of that method to be a mock JobRunner that we can verify? Disclaimer though, I'm not sure what the best practices are of using spies...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, I figured that too. In general, I prefer not to mess with production code for the sake of unit tests.

The current unit actually test the new flow, I passed null SamzaApplication to RemoteApplicationRunner's constructor. In RemoteApplicationRunner#run, if it goes the legacy flow, it will throw exception when constructing RemoteJobPlanner where SamzaApplication is required. Do you think this is enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is some precedence elsewhere in samza code; ZkJobCoordinator.readJobModelFromMetadataStore for example uses a similar method structure + spy in unit test.

You are correct that the test written now does ensure that the legacy flow isn't triggered, but it does little to verify the behavior of the new flow. I won't block the PR on this though.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 that there is a bit of missing test coverage here. It would be nice if this class was set up better for improved testing, but I also won't block the PR on this.

Copy link
Contributor

@bkonold bkonold left a comment

Choose a reason for hiding this comment

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

LGTM, but make sure you take a look at the CI results.

…atus and waitForFinish. This is also used in ExecutionPlanner as well before.
@cameronlee314 cameronlee314 merged commit d28a1df into apache:master Jan 17, 2020
@kw2542 kw2542 deleted the SAMZA-2408 branch January 17, 2020 23:26
rmatharu-zz pushed a commit to rmatharu-zz/samza that referenced this pull request Jan 21, 2020
…#1247)

1. Depending on the existence of job.config.loader.factory, RemoteApplicationRunner will alternatively only submit the job, without planning.
2. Late initialize RemoteJobPlanner only when needed to avoid executing user code in submitting only mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants