From 114e34ae5754e4f020bf6378cf60daa67aacadd0 Mon Sep 17 00:00:00 2001 From: hunter-cloud09 Date: Fri, 1 Mar 2024 09:03:48 +0800 Subject: [PATCH 1/4] feat: server init --- build.sh | 2 +- seatunnel-server/seatunnel-app/pom.xml | 2 +- .../service/impl/JobExecutorServiceImpl.java | 4 ++-- .../src/main/resources/hazelcast-client.yaml | 24 +++++++++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml diff --git a/build.sh b/build.sh index cf2e47ae2..216bf2527 100644 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ fi # build code code() { - /bin/sh $WORKDIR/mvnw clean package -DskipTests -Pci + mvn clean install -DskipTests -Pci # mv release zip mv $WORKDIR/seatunnel-web-dist/target/apache-seatunnel-web-*.zip $WORKDIR/ } diff --git a/seatunnel-server/seatunnel-app/pom.xml b/seatunnel-server/seatunnel-app/pom.xml index 24c2a44fe..b6a94db22 100644 --- a/seatunnel-server/seatunnel-app/pom.xml +++ b/seatunnel-server/seatunnel-app/pom.xml @@ -479,7 +479,7 @@ mysql mysql-connector-java ${mysql.version} - test + compile diff --git a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java index 947519f1f..3542e5019 100644 --- a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java +++ b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java @@ -76,9 +76,9 @@ public Result jobExecute(Integer userId, Long jobDefineId) { } public String writeJobConfigIntoConfFile(String jobConfig, Long jobDefineId) { - String projectRoot = System.getProperty("user.dir"); + String projectRoot = System.getProperty("SEATUNNEL_HOME"); String filePath = - projectRoot + File.separator + "profile" + File.separator + jobDefineId + ".conf"; + projectRoot + File.separator + "json" + File.separator + jobDefineId + ".conf"; try { File file = new File(filePath); if (!file.exists()) { diff --git a/seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml b/seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml new file mode 100644 index 000000000..1e2f7fdc2 --- /dev/null +++ b/seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml @@ -0,0 +1,24 @@ +# +# 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. +# + +hazelcast-client: + cluster-name: seatunnel + properties: + hazelcast.logging.type: log4j2 + network: + cluster-members: + - 106.15.250.130:5801 \ No newline at end of file From 749cb4755fbe56e4721d198e7e41978ec51e199b Mon Sep 17 00:00:00 2001 From: hunter-cloud09 Date: Fri, 1 Mar 2024 14:18:47 +0800 Subject: [PATCH 2/4] fix: web fix package web dist error --- .../dag/node-setting.tsx | 2 +- .../dag/use-node-setting.ts | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/seatunnel-ui/src/views/task/synchronization-definition/dag/node-setting.tsx b/seatunnel-ui/src/views/task/synchronization-definition/dag/node-setting.tsx index 0461b70b8..8e82343ca 100644 --- a/seatunnel-ui/src/views/task/synchronization-definition/dag/node-setting.tsx +++ b/seatunnel-ui/src/views/task/synchronization-definition/dag/node-setting.tsx @@ -37,7 +37,7 @@ const props = { default: false }, nodeInfo: { - type: Object as PropType, + type: Object as any, default: {} } } diff --git a/seatunnel-ui/src/views/task/synchronization-definition/dag/use-node-setting.ts b/seatunnel-ui/src/views/task/synchronization-definition/dag/use-node-setting.ts index 62f1b7ddf..230bcc825 100644 --- a/seatunnel-ui/src/views/task/synchronization-definition/dag/use-node-setting.ts +++ b/seatunnel-ui/src/views/task/synchronization-definition/dag/use-node-setting.ts @@ -43,14 +43,14 @@ export function useNodeSettingModal( const formatParams = (values: any) => { const params = { - pluginId: props.nodeInfo.pluginId, + pluginId: props.nodeInfo?.pluginId, name: values.name, - type: props.nodeInfo.type.toUpperCase(), + type: props.nodeInfo?.type.toUpperCase(), connectorType: - props.nodeInfo.type === 'transform' - ? props.nodeInfo.connectorType + props.nodeInfo?.type === 'transform' + ? props.nodeInfo?.connectorType : null - } as { [key: string]: any } + } as any; const config = omit(values, [ 'name', 'datasourceInstanceId', @@ -119,8 +119,8 @@ export function useNodeSettingModal( // Determine whether the current node type is Transform or Sink and there is no previous node. if ( - (props.nodeInfo.type === 'transform' || props.nodeInfo.type === 'sink') && - !props.nodeInfo.predecessorsNodeId + (props.nodeInfo?.type === 'transform' || props.nodeInfo?.type === 'sink') && + !props.nodeInfo?.predecessorsNodeId ) { window.$message.warning(t('project.synchronization_definition.node_prev_check_tips')) return false @@ -138,7 +138,7 @@ export function useNodeSettingModal( const values = configurationFormRef.value.getValues() let modelOutputTableData - if (props.nodeInfo.type === 'source') { + if (props.nodeInfo?.type === 'source') { const resultSchema = modelRef.value.getOutputSchema() // check debezium if (values.format && values.format === 'COMPATIBLE_DEBEZIUM_JSON') { @@ -172,13 +172,13 @@ export function useNodeSettingModal( } } - if (props.nodeInfo.type === 'transform' && props.nodeInfo.predecessorsNodeId) { + if (props.nodeInfo?.type === 'transform' && props.nodeInfo?.predecessorsNodeId) { const resultSchema = modelRef.value.getOutputSchema() if (resultSchema.allTableData.length) { if ( - props.nodeInfo.connectorType === 'FieldMapper' || - props.nodeInfo.connectorType === 'MultiFieldSplit' || - props.nodeInfo.connectorType === 'Copy' + props.nodeInfo?.connectorType === 'FieldMapper' || + props.nodeInfo?.connectorType === 'MultiFieldSplit' || + props.nodeInfo?.connectorType === 'Copy' ) { const result = resultSchema.allTableData if (resultSchema.outputTableData.length) { @@ -197,7 +197,7 @@ export function useNodeSettingModal( const transformOptions: any = {} - if (props.nodeInfo.connectorType === 'FieldMapper') { + if (props.nodeInfo?.connectorType === 'FieldMapper') { const resultSchema = modelRef.value.getOutputSchema() transformOptions.changeOrders = resultSchema.outputTableData.map((o: any, i: number) => { return { @@ -212,7 +212,7 @@ export function useNodeSettingModal( const outputTableDataNames = resultSchema.outputTableData.map((o: any) => ({sourceFieldName: o.original_field})) const inputTableDataNames = resultSchema.inputTableData.map((o: any) => ({sourceFieldName: o.name})) transformOptions.deleteFields = _.xorWith(outputTableDataNames, inputTableDataNames, _.isEqual) - } else if (props.nodeInfo.connectorType === 'MultiFieldSplit') { + } else if (props.nodeInfo?.connectorType === 'MultiFieldSplit') { const resultSchema = modelRef.value.getOutputSchema() const hasSeparator = resultSchema.outputTableData.filter((o: any) => o.separator) transformOptions.splits = _.uniqWith(hasSeparator.map((o: any) => { @@ -222,14 +222,14 @@ export function useNodeSettingModal( outputFields: _.groupBy(hasSeparator, 'separator')[o.separator].map((h: any) => h.name) } }), _.isEqual) - } else if (props.nodeInfo.connectorType === 'Copy') { + } else if (props.nodeInfo?.connectorType === 'Copy') { const resultSchema = modelRef.value.getOutputSchema() const hasCopyColumn = resultSchema.outputTableData.filter((o: any) => o.copyTimes === -1) transformOptions.copyList = hasCopyColumn.map((h: any) => ({ sourceFieldName: h.original_field, targetFieldName: h.name })) - } else if(props.nodeInfo.connectorType === 'Sql') { + } else if(props.nodeInfo?.connectorType === 'Sql') { const resultSchema = modelRef.value.getOutputSchema() const tableInfo = resultSchema.allTableData[0].tableInfos transformOptions.sql = { @@ -286,9 +286,9 @@ export function useNodeSettingModal( datasourceName: node.datasourceName, datasourceInstanceId: node.datasourceInstanceId, columnSelectable: node.columnSelectable, - outputSchema: props.nodeInfo.outputSchema, + outputSchema: props.nodeInfo?.outputSchema, sceneMode: node.sceneMode ? node.sceneMode : '', - transformOptions: props.nodeInfo.transformOptions + transformOptions: props.nodeInfo?.transformOptions } if (node.format && node.format === 'COMPATIBLE_DEBEZIUM_JSON') { From d1e5327cc9c6d1e50dc87b842b3ee31b4d14d5e4 Mon Sep 17 00:00:00 2001 From: hunter-cloud09 Date: Fri, 1 Mar 2024 14:25:38 +0800 Subject: [PATCH 3/4] reset something --- seatunnel-server/seatunnel-app/pom.xml | 2 +- .../service/impl/JobExecutorServiceImpl.java | 4 ++-- .../src/main/resources/hazelcast-client.yaml | 24 ------------------- 3 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml diff --git a/seatunnel-server/seatunnel-app/pom.xml b/seatunnel-server/seatunnel-app/pom.xml index b6a94db22..24c2a44fe 100644 --- a/seatunnel-server/seatunnel-app/pom.xml +++ b/seatunnel-server/seatunnel-app/pom.xml @@ -479,7 +479,7 @@ mysql mysql-connector-java ${mysql.version} - compile + test diff --git a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java index 3542e5019..947519f1f 100644 --- a/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java +++ b/seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/JobExecutorServiceImpl.java @@ -76,9 +76,9 @@ public Result jobExecute(Integer userId, Long jobDefineId) { } public String writeJobConfigIntoConfFile(String jobConfig, Long jobDefineId) { - String projectRoot = System.getProperty("SEATUNNEL_HOME"); + String projectRoot = System.getProperty("user.dir"); String filePath = - projectRoot + File.separator + "json" + File.separator + jobDefineId + ".conf"; + projectRoot + File.separator + "profile" + File.separator + jobDefineId + ".conf"; try { File file = new File(filePath); if (!file.exists()) { diff --git a/seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml b/seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml deleted file mode 100644 index 1e2f7fdc2..000000000 --- a/seatunnel-server/seatunnel-app/src/main/resources/hazelcast-client.yaml +++ /dev/null @@ -1,24 +0,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. -# - -hazelcast-client: - cluster-name: seatunnel - properties: - hazelcast.logging.type: log4j2 - network: - cluster-members: - - 106.15.250.130:5801 \ No newline at end of file From 9ea1cd59b1a2ce8c96468a63c5b879955acabe98 Mon Sep 17 00:00:00 2001 From: hunter-cloud09 Date: Fri, 1 Mar 2024 14:26:06 +0800 Subject: [PATCH 4/4] reset something --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 216bf2527..cf2e47ae2 100644 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ fi # build code code() { - mvn clean install -DskipTests -Pci + /bin/sh $WORKDIR/mvnw clean package -DskipTests -Pci # mv release zip mv $WORKDIR/seatunnel-web-dist/target/apache-seatunnel-web-*.zip $WORKDIR/ }