Skip to content

Commit 6e65cd6

Browse files
committed
Fix NPM when DolphinScheduler build NULL parameters.
1 parent ce43b0e commit 6e65cd6

File tree

1 file changed

+10
-5
lines changed
  • plugins/dolphinscheduler/dss-dolphinscheduler-client/src/main/scala/com/webank/wedatasphere/dss/plugins/dolphinscheduler/linkis/client/job

1 file changed

+10
-5
lines changed

plugins/dolphinscheduler/dss-dolphinscheduler-client/src/main/scala/com/webank/wedatasphere/dss/plugins/dolphinscheduler/linkis/client/job/DolphinSchedulerJobBuilder.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ class DolphinSchedulerJobBuilder(jobProps: JMap[String, String]) extends Builder
3232

3333
override protected def fillLinkisJobInfo(linkisJob: LinkisJob): Unit = {
3434
val jobParams = jobProps.get(LinkisJobTypeConf.JOB_PARAMS)
35-
val paramsMap = JsonUtils.jackson.readValue(jobParams, classOf[util.Map[String, Object]])
36-
linkisJob.setConfiguration(getConfiguration(paramsMap))
37-
linkisJob.setVariables(getVariables(paramsMap))
38-
linkisJob.getVariables.put("run_date", jobProps.get(LinkisJobTypeConf.RUN_DATE))
35+
if(StringUtils.isNotBlank(jobParams)){
36+
val paramsMap = JsonUtils.jackson.readValue(jobParams, classOf[util.Map[String, Object]])
37+
linkisJob.setConfiguration(getConfiguration(paramsMap))
38+
linkisJob.setVariables(getVariables(paramsMap))
39+
linkisJob.getVariables.put("run_date", jobProps.get(LinkisJobTypeConf.RUN_DATE))
40+
}
3941
val source = getSource
4042
linkisJob.setSource(source)
4143
linkisJob.getRuntimeParams.put("nodeName", source.get("nodeName"))
@@ -45,7 +47,10 @@ class DolphinSchedulerJobBuilder(jobProps: JMap[String, String]) extends Builder
4547
override protected def getContextID(job: Job): String = jobProps.get(LinkisJobExecutionConfiguration.FLOW_CONTEXTID)
4648

4749
override protected def fillCommonLinkisJobInfo(commonLinkisJob: CommonLinkisJob): Unit = {
48-
commonLinkisJob.setJobResourceList(LinkisJobExecutionUtils.getResourceListByJson(jobProps.get(LinkisJobTypeConf.JOB_RESOURCES)))
50+
val jobResources = jobProps.get(LinkisJobTypeConf.JOB_RESOURCES)
51+
if(StringUtils.isNotBlank(jobResources)){
52+
commonLinkisJob.setJobResourceList(LinkisJobExecutionUtils.getResourceListByJson(jobResources))
53+
}
4954
val flowNameAndResources = new util.HashMap[String, util.List[BMLResource]]
5055
if(jobProps.containsKey(LinkisJobTypeConf.FLOW_RESOURCES)) {
5156
flowNameAndResources.put(getSource.get("flowName") + LinkisJobExecutionConfiguration.RESOURCES_NAME,

0 commit comments

Comments
 (0)