From d258d23f140e0b6a97ede06498836b46f53252ff Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Sat, 16 Jul 2022 23:48:00 +0800 Subject: [PATCH 1/6] [Feature][Task Plugin] Increase zeppelin task stability in production (#10584) --- .../task/zeppelin/ZeppelinParameters.java | 12 ++++- .../plugin/task/zeppelin/ZeppelinTask.java | 22 ++++++++- .../task/zeppelin/ZeppelinTaskTest.java | 46 +++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java index 0c67e4f69b9f..358d7db354ec 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java @@ -33,6 +33,7 @@ public class ZeppelinParameters extends AbstractParameters { private String noteId; private String paragraphId; private String restEndpoint; + private String productionNoteDirectory; private String parameters; @Override @@ -77,12 +78,21 @@ public void setRestEndpoint(String restEndpoint) { this.restEndpoint = restEndpoint; } + public String getproductionNoteDirectory() { + return productionNoteDirectory; + } + + public void setproductionNoteDirectory(String productionNoteDirectory) { + this.productionNoteDirectory = productionNoteDirectory; + } + @Override public String toString() { return "ZeppelinParameters{" + "noteId='" + noteId + '\'' - + ", paragraphId='" + paragraphId + '\'' + + ", paragraphId='" + paragraphId + '\'' + ", restEndpoint='" + restEndpoint + '\'' + + ", productionNoteDirectory='" + productionNoteDirectory + '\'' + ", parameters='" + parameters + '\'' + '}'; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java index ca850dcbbc45..4bc00ece02e9 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java @@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; +import org.apache.dolphinscheduler.spi.utils.DateUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.zeppelin.client.ClientConfig; import org.apache.zeppelin.client.NoteResult; @@ -76,9 +77,11 @@ public void init() { @Override public void handle() throws Exception { try { - final String noteId = this.zeppelinParameters.getNoteId(); final String paragraphId = this.zeppelinParameters.getParagraphId(); + final String productionNoteDirectory = this.zeppelinParameters.getproductionNoteDirectory(); final String parameters = this.zeppelinParameters.getParameters(); + // noteId may be replaced with cloned noteId + String noteId = this.zeppelinParameters.getNoteId(); Map zeppelinParamsMap = new HashMap<>(); if (parameters != null) { ObjectMapper mapper = new ObjectMapper(); @@ -88,6 +91,16 @@ public void handle() throws Exception { // Submit zeppelin task String resultContent; Status status = Status.FINISHED; + // If in production, clone the note and run the cloned one for stability + if (productionNoteDirectory != null) { + final String cloneNotePath = String.format( + "%s%s_%s", + productionNoteDirectory, + noteId, + DateUtils.getTimestampString()); + noteId = this.zClient.cloneNote(noteId, cloneNotePath); + } + if (paragraphId == null) { final NoteResult noteResult = this.zClient.executeNote(noteId, zeppelinParamsMap); final List paragraphResultList = noteResult.getParagraphResultList(); @@ -105,6 +118,7 @@ public void handle() throws Exception { break; } } + resultContent = resultContentBuilder.toString(); } else { final ParagraphResult paragraphResult = this.zClient.executeParagraph(noteId, paragraphId, zeppelinParamsMap); @@ -112,6 +126,11 @@ public void handle() throws Exception { status = paragraphResult.getStatus(); } + // Delete cloned note + if (productionNoteDirectory != null) { + this.zClient.deleteNote(noteId); + } + // Use noteId-paragraph-Id as app id final int exitStatusCode = mapStatusToExitCode(status); setAppIds(String.format("%s-%s", noteId, paragraphId)); @@ -121,6 +140,7 @@ public void handle() throws Exception { setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); logger.error("zeppelin task submit failed with error", e); } + } /** diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java index 4670e87872d9..5b2f0ca6ada1 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; +import org.apache.dolphinscheduler.spi.utils.DateUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; @@ -54,6 +55,7 @@ ZeppelinTask.class, ZeppelinClient.class, ObjectMapper.class, + DateUtils.class }) @PowerMockIgnore({"javax.*"}) public class ZeppelinTaskTest { @@ -62,6 +64,8 @@ public class ZeppelinTaskTest { private static final String MOCK_PARAGRAPH_ID = "paragraph_1648793472526_1771221396"; private static final String MOCK_PARAMETERS = "{\"key1\": \"value1\", \"key2\": \"value2\"}"; private static final String MOCK_REST_ENDPOINT = "localhost:8080"; + private static final String MOCK_CLONE_NOTE_ID = "3GYJR92R8"; + private static final String MOCK_PRODUCTION_DIRECTORY = "/prod/"; private final ObjectMapper mapper = new ObjectMapper(); private ZeppelinClient zClient; @@ -161,6 +165,37 @@ public void testHandleWithNoteExecutionSuccess() throws Exception { Assert.assertEquals(EXIT_CODE_SUCCESS, this.zeppelinTask.getExitStatusCode()); } + @Test + public void testHandleWithNoteExecutionSuccessWithProductionSetting() throws Exception { + String zeppelinParametersWithNoParagraphId = buildZeppelinTaskParametersWithProductionSetting(); + TaskExecutionContext taskExecutionContext= PowerMockito.mock(TaskExecutionContext.class); + PowerMockito.mockStatic(DateUtils.class); + when(taskExecutionContext.getTaskParams()).thenReturn(zeppelinParametersWithNoParagraphId); + this.zeppelinTask = spy(new ZeppelinTask(taskExecutionContext)); + + // mock zClient and note result + this.zClient = mock(ZeppelinClient.class); + this.noteResult = mock(NoteResult.class); + + // use mocked zClient in zeppelinTask + doReturn(this.zClient).when(this.zeppelinTask, "getZeppelinClient"); + when(this.zClient.cloneNote(any(String.class), any(String.class))).thenReturn(MOCK_CLONE_NOTE_ID); + when(this.zClient.executeNote(any(), any(Map.class))).thenReturn(this.noteResult); + when(paragraphResult.getResultInText()).thenReturn("mock-zeppelin-paragraph-execution-result"); + this.zeppelinTask.init(); + when(this.paragraphResult.getStatus()).thenReturn(Status.FINISHED); + when(DateUtils.getTimestampString()).thenReturn("123456789"); + this.zeppelinTask.handle(); + Mockito.verify(this.zClient).cloneNote( + MOCK_NOTE_ID, + String.format("%s%s_%s", MOCK_PRODUCTION_DIRECTORY, MOCK_NOTE_ID, "123456789")); + Mockito.verify(this.zClient).executeNote(MOCK_CLONE_NOTE_ID, + (Map) mapper.readValue(MOCK_PARAMETERS, Map.class)); + Mockito.verify(this.noteResult).getParagraphResultList(); + Mockito.verify(this.zClient).deleteNote(MOCK_CLONE_NOTE_ID); + Assert.assertEquals(EXIT_CODE_SUCCESS, this.zeppelinTask.getExitStatusCode()); + } + private String buildZeppelinTaskParameters() { ZeppelinParameters zeppelinParameters = new ZeppelinParameters(); zeppelinParameters.setNoteId(MOCK_NOTE_ID); @@ -179,4 +214,15 @@ private String buildZeppelinTaskParametersWithNoParagraphId() { return JSONUtils.toJsonString(zeppelinParameters); } + + private String buildZeppelinTaskParametersWithProductionSetting() { + ZeppelinParameters zeppelinParameters = new ZeppelinParameters(); + zeppelinParameters.setNoteId(MOCK_NOTE_ID); + zeppelinParameters.setParameters(MOCK_PARAMETERS); + zeppelinParameters.setRestEndpoint(MOCK_REST_ENDPOINT); + zeppelinParameters.setproductionNoteDirectory(MOCK_PRODUCTION_DIRECTORY); + + return JSONUtils.toJsonString(zeppelinParameters); + } + } \ No newline at end of file From 9f5d73b95a98db60975c020e33f663e3bf4051da Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Sun, 17 Jul 2022 02:39:51 +0800 Subject: [PATCH 2/6] Add front-end and update docs for the production mode of zeppelin task --- docs/docs/en/guide/task/zeppelin.md | 12 ++++++++++++ docs/docs/zh/guide/task/zeppelin.md | 11 +++++++++++ .../plugin/task/zeppelin/ZeppelinTaskTest.java | 10 +++++----- dolphinscheduler-ui/src/locales/en_US/project.ts | 2 ++ dolphinscheduler-ui/src/locales/zh_CN/project.ts | 2 ++ .../task/components/node/fields/use-zeppelin.ts | 8 ++++++++ .../projects/task/components/node/format-data.ts | 1 + .../src/views/projects/task/components/node/types.ts | 2 ++ 8 files changed, 43 insertions(+), 5 deletions(-) diff --git a/docs/docs/en/guide/task/zeppelin.md b/docs/docs/en/guide/task/zeppelin.md index c88c0b92b81e..8c8de9dae65c 100644 --- a/docs/docs/en/guide/task/zeppelin.md +++ b/docs/docs/en/guide/task/zeppelin.md @@ -26,9 +26,21 @@ it will call `Zeppelin Client API` to trigger zeppelin notebook paragraph. Click | Timeout alarm | Check Timeout Alarm and Timeout Failure. When the task exceeds the "timeout duration", an alarm email will be sent and the task execution will fail. | | 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 Production Note Directory | The directory for cloned note in production mode. | | Zeppelin Rest Endpoint | The REST endpoint of your zeppelin server | | Zeppelin Parameters | Parameters in json format used for zeppelin dynamic form. | +## Production (Clone) Mode + +- Fill in the optional `Zeppelin Production Note Directory` parameter to enable `Production Mode`. +- In `Production Mode`, the target note gets copied to the `Zeppelin Production Note Directory` you choose. +`Zeppelin Task Plugin` will execute the cloned note instead of the original one. Once execution done, +`Zeppelin Task Plugin` will delete the cloned note automatically. +Therefore, it increases the stability as the modification to a running note triggered by `Dolphin Scheduler` +will not affect the production task. +- If you leave the `Zeppelin Production Note Directory` empty, `Zeppelin Task Plugin` will execute the original note. +- 'Zeppelin Production Note Directory' should both start and end with a `slash`. e.g. `/production_note_directory/` + ## Task Example ### Zeppelin Paragraph Task Example diff --git a/docs/docs/zh/guide/task/zeppelin.md b/docs/docs/zh/guide/task/zeppelin.md index eb802d5cfb4d..ac3bebc69011 100644 --- a/docs/docs/zh/guide/task/zeppelin.md +++ b/docs/docs/zh/guide/task/zeppelin.md @@ -24,8 +24,19 @@ - Zeppelin Note ID:Zeppelin Note对应的唯一ID。 - Zeppelin Paragraph ID:Zeppelin Paragraph对应的唯一ID。如果你想一次性调度整个note,这一栏不填即可。 - Zeppelin Rest Endpoint:您的Zeppelin服务的REST Endpoint。 +- Zeppelin Production Note Directory:生产模式下存放克隆note的目录。 - Zeppelin Parameters: 用于传入Zeppelin Dynamic Form的参数。 +## 生产(克隆)模式 + +- 填上`Zeppelin Production Note Directory`参数以启动`生产模式`。 +- 在`生产模式`下,目标note会被克隆到您所填的`Zeppelin Production Note Directory`目录下。 +`Zeppelin任务插件`将会执行克隆出来的note并在执行成功后自动清除它。 +因为在此模式下,如果您不小心修改了正在被`Dolphin Scheduler`调度的note,也不会影响到生产任务的执行, +从而提高了稳定性。 +- 如果您选择不填`Zeppelin Production Note Directory`这个参数,`Zeppelin任务插件`将会执行您的原始note。 +'Zeppelin Production Note Directory'参数在格式上应该以`斜杠`开头和结尾,例如 `/production_note_directory/`。 + ## Task Example ### Zeppelin Paragraph Task Example diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java index 5b2f0ca6ada1..f6bd55a2acf8 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java @@ -52,10 +52,10 @@ @RunWith(PowerMockRunner.class) @PrepareForTest({ - ZeppelinTask.class, - ZeppelinClient.class, - ObjectMapper.class, - DateUtils.class + ZeppelinTask.class, + ZeppelinClient.class, + ObjectMapper.class, + DateUtils.class }) @PowerMockIgnore({"javax.*"}) public class ZeppelinTaskTest { @@ -168,7 +168,7 @@ public void testHandleWithNoteExecutionSuccess() throws Exception { @Test public void testHandleWithNoteExecutionSuccessWithProductionSetting() throws Exception { String zeppelinParametersWithNoParagraphId = buildZeppelinTaskParametersWithProductionSetting(); - TaskExecutionContext taskExecutionContext= PowerMockito.mock(TaskExecutionContext.class); + TaskExecutionContext taskExecutionContext = PowerMockito.mock(TaskExecutionContext.class); PowerMockito.mockStatic(DateUtils.class); when(taskExecutionContext.getTaskParams()).thenReturn(zeppelinParametersWithNoParagraphId); this.zeppelinTask = spy(new ZeppelinTask(taskExecutionContext)); diff --git a/dolphinscheduler-ui/src/locales/en_US/project.ts b/dolphinscheduler-ui/src/locales/en_US/project.ts index 2ab410ed2dfc..dc7257420c8c 100644 --- a/dolphinscheduler-ui/src/locales/en_US/project.ts +++ b/dolphinscheduler-ui/src/locales/en_US/project.ts @@ -621,6 +621,8 @@ export default { zeppelin_parameters_tips: 'Please enter the parameters for zeppelin dynamic form', zeppelin_rest_endpoint: 'zeppelinRestEndpoint', zeppelin_rest_endpoint_tips: 'Please enter the rest endpoint of your Zeppelin server', + zeppelin_production_note_directory: 'Directory for cloned zeppelin note in production mode', + zeppelin_production_note_directory_tips: 'Please enter the production note directory to enable production mode', jupyter_conda_env_name: 'condaEnvName', jupyter_conda_env_name_tips: 'Please enter the conda environment name of papermill', diff --git a/dolphinscheduler-ui/src/locales/zh_CN/project.ts b/dolphinscheduler-ui/src/locales/zh_CN/project.ts index d6a4758f772f..5be44bf3c24f 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/project.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/project.ts @@ -608,6 +608,8 @@ export default { zeppelin_note_id: 'zeppelinNoteId', zeppelin_note_id_tips: '请输入zeppelin note id', zeppelin_paragraph_id: 'zeppelinParagraphId', + zeppelin_production_note_directory: '生产模式下存放克隆note的目录', + zeppelin_production_note_directory_tips: '请输入生产环境note目录以启用生产模式', zeppelin_paragraph_id_tips: '请输入zeppelin paragraph id', zeppelin_parameters: 'parameters', zeppelin_parameters_tips: '请输入zeppelin dynamic form参数', diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-zeppelin.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-zeppelin.ts index a3077dbd2f85..db16b9bbe1bb 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-zeppelin.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-zeppelin.ts @@ -64,6 +64,14 @@ export function useZeppelin(model: { [field: string]: any }): IJsonItem[] { } } }, + { + type: 'input', + field: 'zeppelinProductionNoteDirectory', + name: t('project.node.zeppelin_production_note_directory'), + props: { + placeholder: t('project.node.zeppelin_production_note_directory_tips') + } + }, { type: 'input', field: 'parameters', diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts index 20209639e5a0..2dcbb321bd54 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts @@ -330,6 +330,7 @@ export function formatParams(data: INodeData): { taskParams.noteId = data.zeppelinNoteId taskParams.paragraphId = data.zeppelinParagraphId taskParams.restEndpoint = data.zeppelinRestEndpoint + taskParams.zeppelinProductionNoteDirectory = data.productionNoteDirectory taskParams.parameters = data.parameters } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts index ced5d4375997..268d8635b8d2 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts @@ -300,6 +300,8 @@ interface ITaskParams { zeppelinParagraphId?: string zeppelinRestEndpoint?: string restEndpoint?: string + zeppelinProductionNoteDirectory?: string + productionNoteDirectory?: string noteId?: string paragraphId?: string condaEnvName?: string From 098df56ed1aca89f1940bb0133bfb590e7a010bd Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Sun, 17 Jul 2022 03:22:57 +0800 Subject: [PATCH 3/6] Fix minor front-end bug of zeppelin task plugin --- .../src/views/projects/task/components/node/format-data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts index 2dcbb321bd54..7a3878bc5846 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts @@ -330,7 +330,7 @@ export function formatParams(data: INodeData): { taskParams.noteId = data.zeppelinNoteId taskParams.paragraphId = data.zeppelinParagraphId taskParams.restEndpoint = data.zeppelinRestEndpoint - taskParams.zeppelinProductionNoteDirectory = data.productionNoteDirectory + taskParams.productionNoteDirectory = data.zeppelinProductionNoteDirectory taskParams.parameters = data.parameters } From 17f1b55f3647bbe4c396d4f0bbd84ef1c677b0a1 Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Sun, 17 Jul 2022 11:58:25 +0800 Subject: [PATCH 4/6] Refactor ZeppelinParameters with lombok --- .../task/zeppelin/ZeppelinParameters.java | 56 ++----------------- .../plugin/task/zeppelin/ZeppelinTask.java | 2 +- .../task/zeppelin/ZeppelinTaskTest.java | 2 +- 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java index 358d7db354ec..8785e6d0534b 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java @@ -17,6 +17,9 @@ package org.apache.dolphinscheduler.plugin.task.zeppelin; + +import lombok.Data; + import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.spi.utils.StringUtils; @@ -24,6 +27,8 @@ import java.util.Collections; import java.util.List; + +@Data public class ZeppelinParameters extends AbstractParameters { /** @@ -46,55 +51,4 @@ public List getResourceFilesList() { return Collections.emptyList(); } - public String getNoteId() { - return noteId; - } - - public void setNoteId(String noteId) { - this.noteId = noteId; - } - - public String getParagraphId() { - return paragraphId; - } - - public void setParagraphId(String paragraphId) { - this.paragraphId = paragraphId; - } - - public String getParameters() { - return parameters; - } - - public void setParameters(String parameters) { - this.parameters = parameters; - } - - public String getRestEndpoint() { - return restEndpoint; - } - - public void setRestEndpoint(String restEndpoint) { - this.restEndpoint = restEndpoint; - } - - public String getproductionNoteDirectory() { - return productionNoteDirectory; - } - - public void setproductionNoteDirectory(String productionNoteDirectory) { - this.productionNoteDirectory = productionNoteDirectory; - } - - @Override - public String toString() { - return "ZeppelinParameters{" - + "noteId='" + noteId + '\'' - + ", paragraphId='" + paragraphId + '\'' - + ", restEndpoint='" + restEndpoint + '\'' - + ", productionNoteDirectory='" + productionNoteDirectory + '\'' - + ", parameters='" + parameters + '\'' - + '}'; - } - } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java index 4bc00ece02e9..4fe0120e2481 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java @@ -78,7 +78,7 @@ public void init() { public void handle() throws Exception { try { final String paragraphId = this.zeppelinParameters.getParagraphId(); - final String productionNoteDirectory = this.zeppelinParameters.getproductionNoteDirectory(); + final String productionNoteDirectory = this.zeppelinParameters.getProductionNoteDirectory(); final String parameters = this.zeppelinParameters.getParameters(); // noteId may be replaced with cloned noteId String noteId = this.zeppelinParameters.getNoteId(); diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java index f6bd55a2acf8..397d68347e2c 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/test/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTaskTest.java @@ -220,7 +220,7 @@ private String buildZeppelinTaskParametersWithProductionSetting() { zeppelinParameters.setNoteId(MOCK_NOTE_ID); zeppelinParameters.setParameters(MOCK_PARAMETERS); zeppelinParameters.setRestEndpoint(MOCK_REST_ENDPOINT); - zeppelinParameters.setproductionNoteDirectory(MOCK_PRODUCTION_DIRECTORY); + zeppelinParameters.setProductionNoteDirectory(MOCK_PRODUCTION_DIRECTORY); return JSONUtils.toJsonString(zeppelinParameters); } From 6f6964f7844a75185c163b5e86d88f2fc56cfed2 Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Sun, 17 Jul 2022 12:11:47 +0800 Subject: [PATCH 5/6] Fix formatting --- .../plugin/task/zeppelin/ZeppelinParameters.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java index 8785e6d0534b..de54ddd79b78 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java @@ -17,7 +17,6 @@ package org.apache.dolphinscheduler.plugin.task.zeppelin; - import lombok.Data; import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; @@ -27,7 +26,6 @@ import java.util.Collections; import java.util.List; - @Data public class ZeppelinParameters extends AbstractParameters { From 313e3ff7e4d42debe21bc0782dc40dfae8430dcb Mon Sep 17 00:00:00 2001 From: EricGao888 Date: Tue, 19 Jul 2022 17:17:16 +0800 Subject: [PATCH 6/6] Replace @Data with @Getter, @Setter, @ToString to avoid decrease in test coverage --- .../plugin/task/zeppelin/ZeppelinParameters.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java index de54ddd79b78..b95c93971f14 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinParameters.java @@ -17,8 +17,9 @@ package org.apache.dolphinscheduler.plugin.task.zeppelin; -import lombok.Data; - +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.spi.utils.StringUtils; @@ -26,7 +27,9 @@ import java.util.Collections; import java.util.List; -@Data +@Getter +@Setter +@ToString public class ZeppelinParameters extends AbstractParameters { /**