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

[ZEPPELIN-5999] Reduce instance objects from Zeppelin #4726

Merged
merged 9 commits into from May 16, 2024

Conversation

Reamer
Copy link
Contributor

@Reamer Reamer commented Mar 5, 2024

What is this PR for?

This PR removes the most important instance objects from Zeppelin.
This PR standardizes our integration tests via the ZeppelinServerMini class.
I was previously unaware that the Zeppelin configuration is also used within interpreters. With these changes I noticed it and the Zeppelin configuration is now available to interpreters.
I have tried to split the PR into meaningful commits. Unfortunately, it is not possible to split the PR further due to the mass of uses of the instance objects.

The ZeppelinServerMini class makes it easy to run integration tests in the IDE. Separate steps such as "download Spark", "download Hadoop", "add SPARK_HOME env" or "start Zeppelin" become obsolete.

You can now also see quite clearly which tests are actually simple unit tests and which should actually be executed as integration tests. A switch to integration tests can be made in a separate pull request.

My IDE and locale are set to German. Java adopts this and also outputs some exceptions in German. I don't know how we deal with this, so I have removed language specific asserts.

      // depends on JVM language
      // assertTrue(stacktrace.contains("No such file or directory"), stacktrace);

What type of PR is it?

  • Improvement

Todos

  • - Task

What is the Jira issue?

How should this be tested?

  • CI

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? Yes
  • Does this needs documentation? No

@Reamer Reamer changed the title [ZEPPELIN-5999] Reduce Instance Objects out of Zeppelin [ZEPPELIN-5999] Reduce instance objects from Zeppelin Mar 5, 2024
@Reamer Reamer force-pushed the conf_mini branch 2 times, most recently from a8ddf85 to 6fe6219 Compare March 11, 2024 10:49
@Reamer
Copy link
Contributor Author

Reamer commented Mar 11, 2024

I know that the PR is very big. Does anyone feel able to do a review here?

@@ -33,7 +35,7 @@
*/
public interface NotebookRepo extends Closeable {

void init(ZeppelinConfiguration zConf) throws IOException;
void init(ZeppelinConfiguration zConf, Gson gson) throws IOException;
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a public API, and users may have custom implementations, such change will break them. Additionally, we'd better avoid leaking the third-party lib classes as much as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good advice. I have wrapped the parser NoteParser in its own interface. It should now be possible to implement a custom parser easily. The implementation of the interface must of course be done by the people who don't want the default (GsonNoteParser).
GSON will not become more widespread with the change and we can also switch more easily via this interface.

@@ -30,7 +30,6 @@ public class InterpreterOption {
public static final transient String SHARED = "shared";
public static final transient String SCOPED = "scoped";
public static final transient String ISOLATED = "isolated";
private static ZeppelinConfiguration conf = ZeppelinConfiguration.create();
Copy link
Member

@pan3793 pan3793 Mar 15, 2024

Choose a reason for hiding this comment

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

how about converting this static field from static to a member field? then we don't need to change the signature of getOwners method.

some thoughts: current change makes the API inconsistent, only part of getXXX methods require conf parameter

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 don't really like the implementation. See ec3c312
What do you think?

return conf;
}
return ZeppelinConfiguration.create(null);
public static ZeppelinConfiguration load() {
Copy link
Member

Choose a reason for hiding this comment

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

I see the impl change, but what's the benefit of renaming method create to load

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this name change, it was easier to see the usage. Also, I think create as a method name is not really well chosen, it loads the configuration from a file. I already have a reload method in mind, but that is far in the future.

@Reamer Reamer force-pushed the conf_mini branch 2 times, most recently from 64df684 to dbce76b Compare March 20, 2024 11:49
@Reamer Reamer requested review from pan3793 and jongyoul and removed request for pan3793 March 28, 2024 08:07
@Reamer Reamer force-pushed the conf_mini branch 2 times, most recently from 2f2ec2d to 4a11e24 Compare April 3, 2024 07:54
@Reamer
Copy link
Contributor Author

Reamer commented Apr 9, 2024

Ready for review.

jongyoul
jongyoul previously approved these changes Apr 11, 2024
Copy link
Member

@jongyoul jongyoul left a comment

Choose a reason for hiding this comment

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

Thank you for the big change. I checked all of code roughly including MiniZeppelinServer, ZeppelinServer, and NoteParser.

Refactoring ZeppelinServer looks good to me especially.

LGTM

@Reamer
Copy link
Contributor Author

Reamer commented Apr 11, 2024

Thank you for your review. My plan is to merge #4746 first and then do this MR.

@jongyoul
Copy link
Member

LGTM. Please feel free to merge it when you're available.

@Reamer Reamer merged commit 3eae255 into apache:master May 16, 2024
28 checks passed
@Reamer Reamer deleted the conf_mini branch May 16, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants