Skip to content

Commit

Permalink
Fix udf bug (DataLinkDC#2501)
Browse files Browse the repository at this point in the history
* Spotless Apply

* Spotless Apply

* fix-udf-bug

* fix-udf-bug

* modify git build model layout

* fix table enum bug

* Spotless Apply

* modify some code

* Spotless Apply

* modify some code

* modify git build model layout && udf bug

* modify some code

* modify some code

* Spotless Apply

---------

Co-authored-by: zhu-mingye <[email protected]>
  • Loading branch information
Zzm0809 and zhu-mingye authored Nov 8, 2023
1 parent 59a3222 commit 7563410
Show file tree
Hide file tree
Showing 22 changed files with 483 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public class GitProject extends SuperEntity<GitProject> {
@TableField(value = "build_state")
private Integer buildState;

/**
* 区别于 java 和 Python 类型 | different from java and python;
* 1. 构建 java 工程时: 步骤值映射如下: 0: 环境检查 1: 克隆项目 2: 编译构建 3: 获取产物 4: 分析 UDF 5: 完成; (when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish)
* 2. 构建 python 工程时: 步骤值映射如下: 0: 环境检查 1: 克隆项目 2: 获取产物 3: 分析 UDF 4: 完成;(when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish)
*/
@ApiModelProperty(value = "Build Step", dataType = "Integer")
@TableField(value = "build_step")
private Integer buildStep;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public File getFile(Integer id) {
Resources resources = getById(id);
Assert.notNull(resources, () -> new BusException(Status.RESOURCE_DIR_OR_FILE_NOT_EXIST));
Assert.isFalse(resources.getSize() > ALLOW_MAX_CAT_CONTENT_SIZE, () -> new BusException("file is too large!"));
return URLUtils.toFile("rs:" + resources.getFullName());
return URLUtils.toFile("rs://" + resources.getFullName());
}

@Transactional(rollbackFor = Exception.class)
Expand Down
29 changes: 27 additions & 2 deletions dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public static boolean build(
} else {
localRepositoryDirectory = repositoryDir;
}
String mavenCommandLine = getMavenCommandLine(pom, mavenHome, localRepositoryDirectory, setting, goals, args);
String mavenCommandLine =
getMavenCommandLineByMvn(pom, mavenHome, localRepositoryDirectory, setting, goals, args);
Opt.ofNullable(consumer).ifPresent(c -> c.accept("Executing command: " + mavenCommandLine + "\n"));

int waitValue = RuntimeUtils.run(
Expand All @@ -102,7 +103,7 @@ public static boolean build(
s = DateUtil.date().toMsStr() + " - " + s + "\n";
consumer.accept(s);
},
log::error);
consumer::accept);
return waitValue == 0;
}

Expand Down Expand Up @@ -149,6 +150,30 @@ public static String getMavenCommandLine(
return StrUtil.join(" ", commandLine);
}

public static String getMavenCommandLineByMvn(
String projectDir,
String mavenHome,
String repositoryDir,
String settingsPath,
List<String> goals,
List<String> args) {
projectDir = StrUtil.wrap(projectDir, "\"");
settingsPath = StrUtil.wrap(settingsPath, "\"");
List<String> commandLine = new LinkedList<>();

commandLine.add(mavenHome + "/bin/mvn");
commandLine.add("-Dmaven.multiModuleProjectDirectory=" + projectDir);
commandLine.add("-Dmaven.home=" + StrUtil.wrap(mavenHome, "\""));
Opt.ofBlankAble(repositoryDir)
.ifPresent(x -> commandLine.add("-Dmaven.repo.local=" + StrUtil.wrap(repositoryDir, "\"")));
commandLine.add("-Dclassworlds.conf=" + StrUtil.wrap(mavenHome + "/bin/m2.conf", "\""));
commandLine.add("-s " + settingsPath);
commandLine.add("-f " + projectDir);
commandLine.add(StrUtil.join(" ", args));
commandLine.add(StrUtil.join(" ", goals));
return StrUtil.join(" ", commandLine);
}

public static String getMavenVersion() {
return RuntimeUtil.execForStr(getMavenHome() + "/bin/" + EXECTOR + " -v");
}
Expand Down
6 changes: 4 additions & 2 deletions dinky-admin/src/main/java/org/dinky/utils/RuntimeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.lang.Opt;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -61,7 +62,8 @@ public static int run(String shell, Consumer<String> outputConsumer, Consumer<St
reader.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
errorConsumer.accept(ExceptionUtil.stacktraceToOneLineString(e));
RUNNING.remove(process);
}
})
.start();
Expand All @@ -74,7 +76,7 @@ public static int run(String shell, Consumer<String> outputConsumer, Consumer<St
Opt.ofNullable(errorConsumer).ifPresent(x -> x.accept(errMsg));
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
errorConsumer.accept(ExceptionUtil.stacktraceToOneLineString(e));
}
return waitValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ds.work.flow.not.save=Please Save Workflow First
schedule.status.unknown=Unknown Status: {0}
user.binding.role.delete.all=User Binding Role Delete All
modify.failed=Update Failed
git.build.success=Git Build Success
git.build.success=Pre-update status success, start executing the build process
menu.has.child=Menu Has Child, Can Not Delete
tenant.already.exists=Tenant Already Exists
save.failed=Save Failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ds.work.flow.not.save=\u8BF7\u5148\u4FDD\u5B58\u5DE5\u4F5C\u6D41
schedule.status.unknown=\u672A\u77E5\u72B6\u6001: {0}
user.binding.role.delete.all=\u7528\u6237\u7ED1\u5B9A\u89D2\u8272\u5220\u9664\u6240\u6709
modify.failed=\u4FEE\u6539\u5931\u8D25
git.build.success=\u6784\u5EFA\u6210\u529F
git.build.success=\u9884\u66F4\u65B0\u72B6\u6001\u6210\u529F,\u5F00\u59CB\u6267\u884C\u6784\u5EFA\u6D41\u7A0B
menu.has.child=\u5B58\u5728\u5B50\u83DC\u5355 \u4E0D\u5141\u8BB8\u5220\u9664
tenant.already.exists=\u79DF\u6237\u5DF2\u5B58\u5728
save.failed=\u4FDD\u5B58\u5931\u8D25
Expand Down
2 changes: 2 additions & 0 deletions dinky-web/src/locales/en-US/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default {
'button.recovery': 'Recovery',
'button.cancel': 'Cancel',
'button.finish': 'Finish',
'button.retry': 'Retry',
'button.rebuild': 'Re Build',
'button.back': 'Back',
'button.save': 'Save',
'button.delete': 'Delete',
Expand Down
3 changes: 2 additions & 1 deletion dinky-web/src/locales/en-US/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,8 @@ export default {
'rc.gp.build.step.1': 'Check Env',
'rc.gp.build.step.2': 'Git Clone',
'rc.gp.build.step.3': 'Maven Build',
'rc.gp.build.step.4': 'Get Jars',
// 获取产物
'rc.gp.build.step.4': 'Get Artifact',
'rc.gp.build.step.5': 'Analysis UDF',
'rc.gp.build.step.6': 'Finish',
'rc.gp.buildArgs': 'Build Arguments',
Expand Down
2 changes: 2 additions & 0 deletions dinky-web/src/locales/zh-CN/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export default {
'button.confirm': '确定',
'button.cancel': '取消',
'button.finish': '完成',
'button.retry': '重试',
'button.rebuild': '重新构建',
'button.back': '返回',
'button.save': '保存',
'button.delete': '删除',
Expand Down
2 changes: 1 addition & 1 deletion dinky-web/src/locales/zh-CN/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ export default {
'rc.gp.build.step.1': '环境检查',
'rc.gp.build.step.2': '克隆项目',
'rc.gp.build.step.3': '编译构建',
'rc.gp.build.step.4': '获取 Jar 包',
'rc.gp.build.step.4': '获取产物',
'rc.gp.build.step.5': '分析 UDF',
'rc.gp.build.step.6': '完成',
'rc.gp.buildArgs': '构建参数',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const ConsoleContent = (props: ConsoleProps) => {
onSelect={onSelect}
treeData={[processNode]}
expandedKeys={expandedKeys}
expandAction={"doubleClick"}
expandAction={'doubleClick'}
onExpand={handleExpand}
/>
) : (
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* 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
* 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.
*
* 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.
*/

import { Height80VHDiv } from '@/components/StyledComponents';
Expand Down
Loading

0 comments on commit 7563410

Please sign in to comment.