Browse Source

[Improvement][Task Plugin] Integrate zeppelin password authentication with DS zeppelin task plugin (#13861)

---------

Co-authored-by: Eric Gao <ericgao.apache@gmail.com>
3.2.0-release
zzm 2 years ago committed by GitHub
parent
commit
35bb533a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      docs/docs/en/guide/task/zeppelin.md
  2. 2
      docs/docs/zh/guide/task/zeppelin.md
  3. 2
      dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java
  4. 12
      dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java
  5. 4
      dolphinscheduler-ui/src/locales/en_US/project.ts
  6. 4
      dolphinscheduler-ui/src/locales/zh_CN/project.ts
  7. 16
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-zeppelin.ts
  8. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts
  9. 4
      dolphinscheduler-ui/src/views/projects/task/components/node/types.ts

6
docs/docs/en/guide/task/zeppelin.md

@ -22,7 +22,11 @@ it will call `Zeppelin Client API` to trigger zeppelin notebook paragraph. Click
| Zeppelin Note ID | The unique note id for a zeppelin notebook note. | | Zeppelin Note ID | The unique note id for a zeppelin notebook note. |
| Zeppelin Paragraph ID | The unique paragraph id for a zeppelin notebook paragraph. If you want to schedule a whole note at a time, leave this field blank. | | Zeppelin Paragraph ID | The unique paragraph id for a zeppelin notebook paragraph. If you want to schedule a whole note at a time, leave this field blank. |
| Zeppelin Production Note Directory | The directory for cloned note in production mode. | | Zeppelin Production Note Directory | The directory for cloned note in production mode. |
| Zeppelin Rest Endpoint | The REST endpoint of your zeppelin server | | Zeppelin username | the login username of your zeppelin server . |
| |
| Zeppelin password | the login password of your zeppelin server . |
| |
| Zeppelin Rest Endpoint | The REST endpoint of your zeppelin server . |
| Zeppelin Parameters | Parameters in json format used for zeppelin dynamic form. | | Zeppelin Parameters | Parameters in json format used for zeppelin dynamic form. |
## Production (Clone) Mode ## Production (Clone) Mode

2
docs/docs/zh/guide/task/zeppelin.md

@ -22,6 +22,8 @@
| Zeppelin Note ID | Zeppelin Note对应的唯一ID | | Zeppelin Note ID | Zeppelin Note对应的唯一ID |
| Zeppelin Paragraph ID | Zeppelin Paragraph对应的唯一ID。如果你想一次性调度整个note,这一栏不填即可 | | Zeppelin Paragraph ID | Zeppelin Paragraph对应的唯一ID。如果你想一次性调度整个note,这一栏不填即可 |
| Zeppelin Rest Endpoint | 您的Zeppelin服务的REST Endpoint | | Zeppelin Rest Endpoint | 您的Zeppelin服务的REST Endpoint |
| Zeppelin username | 您的Zeppelin服务的登陆用户名 |
| Zeppelin password | 您的Zeppelin服务的登陆密码 |
| Zeppelin Production Note Directory | 生产模式下存放克隆note的目录 | | Zeppelin Production Note Directory | 生产模式下存放克隆note的目录 |
| Zeppelin Parameters | 用于传入Zeppelin Dynamic Form的参数 | | Zeppelin Parameters | 用于传入Zeppelin Dynamic Form的参数 |

2
dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java

@ -43,6 +43,8 @@ public class ZeppelinParameters extends AbstractParameters {
private String restEndpoint; private String restEndpoint;
private String productionNoteDirectory; private String productionNoteDirectory;
private String parameters; private String parameters;
private String username;
private String password;
@Override @Override
public boolean checkParameters() { public boolean checkParameters() {

12
dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java

@ -26,6 +26,7 @@ import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.commons.lang3.StringUtils;
import org.apache.zeppelin.client.ClientConfig; import org.apache.zeppelin.client.ClientConfig;
import org.apache.zeppelin.client.NoteResult; import org.apache.zeppelin.client.NoteResult;
import org.apache.zeppelin.client.ParagraphResult; import org.apache.zeppelin.client.ParagraphResult;
@ -79,10 +80,21 @@ public class ZeppelinTask extends AbstractRemoteTask {
this.zClient = getZeppelinClient(); this.zClient = getZeppelinClient();
} }
public boolean login() throws Exception {
String username = this.zeppelinParameters.getUsername();
String password = this.zeppelinParameters.getPassword();
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
this.zClient.login(username, password);
log.info("username : {} login success ", username);
}
return true;
}
// todo split handle to submit and track // todo split handle to submit and track
@Override @Override
public void handle(TaskCallBack taskCallBack) throws TaskException { public void handle(TaskCallBack taskCallBack) throws TaskException {
try { try {
login();
final String paragraphId = this.zeppelinParameters.getParagraphId(); final String paragraphId = this.zeppelinParameters.getParagraphId();
final String productionNoteDirectory = this.zeppelinParameters.getProductionNoteDirectory(); final String productionNoteDirectory = this.zeppelinParameters.getProductionNoteDirectory();
final String parameters = this.zeppelinParameters.getParameters(); final String parameters = this.zeppelinParameters.getParameters();

4
dolphinscheduler-ui/src/locales/en_US/project.ts

@ -680,6 +680,10 @@ export default {
'Directory for cloned zeppelin note in production mode', 'Directory for cloned zeppelin note in production mode',
zeppelin_production_note_directory_tips: zeppelin_production_note_directory_tips:
'Please enter the production note directory to enable production mode', 'Please enter the production note directory to enable production mode',
zeppelin_username: 'zeppelinUsername',
zeppelin_username_tips: 'Please enter the zeppelin server username',
zeppelin_password: 'zeppelinPassword',
zeppelin_password_tips: 'Please enter the zeppelin server password',
hive_cli_task_execution_type: 'Hive Cli Task Execution Type', hive_cli_task_execution_type: 'Hive Cli Task Execution Type',
hive_sql_script: 'Hive SQL Script', hive_sql_script: 'Hive SQL Script',
hive_cli_options: 'Hive Cli Options', hive_cli_options: 'Hive Cli Options',

4
dolphinscheduler-ui/src/locales/zh_CN/project.ts

@ -668,6 +668,10 @@ export default {
zeppelin_parameters_tips: '请输入zeppelin dynamic form参数', zeppelin_parameters_tips: '请输入zeppelin dynamic form参数',
zeppelin_rest_endpoint: 'zeppelinRestEndpoint', zeppelin_rest_endpoint: 'zeppelinRestEndpoint',
zeppelin_rest_endpoint_tips: '请输入zeppelin server的rest endpoint', zeppelin_rest_endpoint_tips: '请输入zeppelin server的rest endpoint',
zeppelin_username: 'zeppelinUsername',
zeppelin_username_tips: '请输入zeppelin server的登陆用户名',
zeppelin_password: 'zeppelinPassword',
zeppelin_password_tips: '请输入zeppelin server的登陆密码',
hive_cli_task_execution_type: 'Hive Cli 任务类型', hive_cli_task_execution_type: 'Hive Cli 任务类型',
hive_sql_script: 'Hive SQL 脚本', hive_sql_script: 'Hive SQL 脚本',
hive_cli_options: 'Hive Cli 选项', hive_cli_options: 'Hive Cli 选项',

16
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-zeppelin.ts

@ -72,6 +72,22 @@ export function useZeppelin(model: { [field: string]: any }): IJsonItem[] {
placeholder: t('project.node.zeppelin_production_note_directory_tips') placeholder: t('project.node.zeppelin_production_note_directory_tips')
} }
}, },
{
type: 'input',
field: 'username',
name: t('project.node.zeppelin_username'),
props: {
placeholder: t('project.node.zeppelin_username_tips')
}
},
{
type: 'input',
field: 'password',
name: t('project.node.zeppelin_password'),
props: {
placeholder: t('project.node.zeppelin_password_tips')
}
},
{ {
type: 'input', type: 'input',
field: 'parameters', field: 'parameters',

2
dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts

@ -334,6 +334,8 @@ export function formatParams(data: INodeData): {
taskParams.noteId = data.noteId taskParams.noteId = data.noteId
taskParams.paragraphId = data.paragraphId taskParams.paragraphId = data.paragraphId
taskParams.restEndpoint = data.restEndpoint taskParams.restEndpoint = data.restEndpoint
taskParams.username = data.username
taskParams.password = data.password
taskParams.productionNoteDirectory = data.productionNoteDirectory taskParams.productionNoteDirectory = data.productionNoteDirectory
taskParams.parameters = data.parameters taskParams.parameters = data.parameters
} }

4
dolphinscheduler-ui/src/views/projects/task/components/node/types.ts

@ -320,6 +320,10 @@ interface ITaskParams {
zeppelinParagraphId?: string zeppelinParagraphId?: string
zeppelinRestEndpoint?: string zeppelinRestEndpoint?: string
restEndpoint?: string restEndpoint?: string
zeppelinUsername?: string
username?: string
zeppelinPassword?: string
password?: string
zeppelinProductionNoteDirectory?: string zeppelinProductionNoteDirectory?: string
productionNoteDirectory?: string productionNoteDirectory?: string
hiveCliOptions?: string hiveCliOptions?: string

Loading…
Cancel
Save