You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2022/04/14 15:46:37 UTC

[GitHub] [zeppelin] Reamer opened a new pull request, #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Reamer opened a new pull request, #4355:
URL: https://github.com/apache/zeppelin/pull/4355

   ### What is this PR for?
   A few sentences describing the overall goals of the pull request's commits.
   First time? Check out the contributing guide - https://zeppelin.apache.org/contribution/contributions.html
   
   
   ### What type of PR is it?
   [Bug Fix | Improvement | Feature | Documentation | Hot Fix | Refactoring]
   
   ### Todos
   * [ ] - Task
   
   ### What is the Jira issue?
   * Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/
   * Put link here, and add [ZEPPELIN-*Jira number*] in PR title, eg. [ZEPPELIN-533]
   
   ### How should this be tested?
   * Strongly recommended: add automated unit tests for any new or changed behavior
   * Outline any manual steps to test the PR here.
   
   ### Screenshots (if appropriate)
   
   ### Questions:
   * Does the licenses files need update?
   * Is there breaking changes for older versions?
   * Does this needs documentation?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] jongyoul commented on pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
jongyoul commented on PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#issuecomment-1240443759

   > What do you think about including hk2 on in the zeppelin-zengine module?
   
   I, totally, agree with you. It would be better to adopt it but to do it, we might need effort to do it. Do you have any idea to do it? Otherwise, we could add some code to ZeppelinServer to enable them.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] Reamer commented on a diff in pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
Reamer commented on code in PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#discussion_r872091416


##########
zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterLauncher.java:
##########
@@ -54,11 +57,11 @@ public InterpreterClient launchDirectly(InterpreterLaunchContext context) throws
 
     StandardInterpreterLauncher interpreterLauncher = null;
     if (isSpark()) {
-      interpreterLauncher = new SparkInterpreterLauncher(zConf, recoveryStorage);
+      interpreterLauncher = (StandardInterpreterLauncher) pluginManager.createInterpreterLauncher("SparkInterpreterLauncher", recoveryStorage);

Review Comment:
   I think it makes no difference, but I changed it.



##########
zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterLauncher.java:
##########
@@ -54,11 +57,11 @@ public InterpreterClient launchDirectly(InterpreterLaunchContext context) throws
 
     StandardInterpreterLauncher interpreterLauncher = null;
     if (isSpark()) {
-      interpreterLauncher = new SparkInterpreterLauncher(zConf, recoveryStorage);
+      interpreterLauncher = (StandardInterpreterLauncher) pluginManager.createInterpreterLauncher("SparkInterpreterLauncher", recoveryStorage);
     } else if (isFlink()) {
-      interpreterLauncher = new FlinkInterpreterLauncher(zConf, recoveryStorage);
+      interpreterLauncher = (StandardInterpreterLauncher) pluginManager.createInterpreterLauncher("FlinkInterpreterLauncher", recoveryStorage);

Review Comment:
   I think it makes no difference, but I changed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] zjffdu commented on a diff in pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
zjffdu commented on code in PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#discussion_r855713929


##########
zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterLauncher.java:
##########
@@ -54,11 +57,11 @@ public InterpreterClient launchDirectly(InterpreterLaunchContext context) throws
 
     StandardInterpreterLauncher interpreterLauncher = null;
     if (isSpark()) {
-      interpreterLauncher = new SparkInterpreterLauncher(zConf, recoveryStorage);
+      interpreterLauncher = (StandardInterpreterLauncher) pluginManager.createInterpreterLauncher("SparkInterpreterLauncher", recoveryStorage);

Review Comment:
   SparkInterpreterLauncher ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] zjffdu commented on a diff in pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
zjffdu commented on code in PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#discussion_r855715888


##########
zeppelin-zengine/pom.xml:
##########
@@ -40,6 +40,7 @@
     <frontend.maven.plugin.version>1.3</frontend.maven.plugin.version>
     <commons.vfs2.version>2.6.0</commons.vfs2.version>
     <eclipse.jgit.version>4.5.4.201711221230-r</eclipse.jgit.version>
+    <pf4j.version>3.6.0</pf4j.version>

Review Comment:
   It is also defined in root pom.xml



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] zjffdu commented on a diff in pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
zjffdu commented on code in PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#discussion_r855714012


##########
zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterLauncher.java:
##########
@@ -54,11 +57,11 @@ public InterpreterClient launchDirectly(InterpreterLaunchContext context) throws
 
     StandardInterpreterLauncher interpreterLauncher = null;
     if (isSpark()) {
-      interpreterLauncher = new SparkInterpreterLauncher(zConf, recoveryStorage);
+      interpreterLauncher = (StandardInterpreterLauncher) pluginManager.createInterpreterLauncher("SparkInterpreterLauncher", recoveryStorage);
     } else if (isFlink()) {
-      interpreterLauncher = new FlinkInterpreterLauncher(zConf, recoveryStorage);
+      interpreterLauncher = (StandardInterpreterLauncher) pluginManager.createInterpreterLauncher("FlinkInterpreterLauncher", recoveryStorage);

Review Comment:
   FlinkInterpreterLauncher ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] Reamer commented on a diff in pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
Reamer commented on code in PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#discussion_r872092418


##########
zeppelin-plugins/notebookrepo/mongo/src/main/java/org/apache/zeppelin/notebook/repo/MongoPlugin.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.notebook.repo;
+
+import org.pf4j.Plugin;
+import org.pf4j.PluginWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MongoPlugin extends Plugin {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(MongoPlugin.class);
+
+  public MongoPlugin(PluginWrapper wrapper) {
+    super(wrapper);
+  }
+
+  @Override
+  public void start() {
+    LOGGER.info("MongoPlugin started");

Review Comment:
   I added a new BasePlugin class that contains the general code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] jongyoul commented on pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
jongyoul commented on PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#issuecomment-1099817333

   I like this kind of improvement :-) BTW, did you have any experience with PF4J before? I heard it for the first time so I just wonder if you are already familiar with it or not.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] Reamer commented on pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
Reamer commented on PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#issuecomment-1105447197

   @zjffdu For a first feedback I would be very grateful.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] Reamer commented on pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
Reamer commented on PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#issuecomment-1102245334

   > BTW, did you have any experience with PF4J before? I heard it for the first time so I just wonder if you are already familiar with it or not.
   
   Not at all, I came across the project with with a quick Google query "Java Plugin Framework".
   The project is under the Apache 2 license and it seems to be actively maintained. There is also good documentation, so the integration into Zeppelin was quite easy.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] zjffdu commented on a diff in pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
zjffdu commented on code in PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#discussion_r855715546


##########
zeppelin-plugins/notebookrepo/mongo/src/main/java/org/apache/zeppelin/notebook/repo/MongoPlugin.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.notebook.repo;
+
+import org.pf4j.Plugin;
+import org.pf4j.PluginWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MongoPlugin extends Plugin {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(MongoPlugin.class);
+
+  public MongoPlugin(PluginWrapper wrapper) {
+    super(wrapper);
+  }
+
+  @Override
+  public void start() {
+    LOGGER.info("MongoPlugin started");

Review Comment:
   It looks like all the Plugin start and stop method are the same, then how about defining a Base Plugin class that implement the start and stop method. And we can just add one field `name` to this base plugin class and each plugin implementation can set value to `name` in the constructor.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] Reamer commented on pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
Reamer commented on PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#issuecomment-1234466448

   @jongyoul 
   I've been thinking about this approach for a while, and I think I wanted to use the pf4j library to compensate for the lack of hk2 in zeppelin-zengine. What do you think about including hk2 on in the zeppelin-zengine module?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zeppelin] jongyoul commented on pull request #4355: [DRAFT] [ZEPPELIN-5722] Improve PluginManager

Posted by GitBox <gi...@apache.org>.
jongyoul commented on PR #4355:
URL: https://github.com/apache/zeppelin/pull/4355#issuecomment-1103683323

   Thank you for the reply. I feel like it's fairly enough.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org