Browse Source
* move version to parent pom * move version properties to parent pom for easy management * remove freemarker dependency * delete CombinedApplicationServer * #1871 correct spelling * #1873 some updates for TaskQueueZkImpl * #1875 remove unused properties in pom * #1878 1. remove tomcat dependency 2. remove combined_logback.xml in api module 3. format pom.xml for not aligning * #1885 fix api server startup failure 1. add jsp-2.1 dependency 2. remove jasper-runtime dependency * add stringutils ut (#1921) * add stringutils ut * Newfeature for #1675. (#1908) Continue to finish the rest works, add the cache feature for dependence,mr,python,sub_process,procedure and shell. * Add modify user name for process definition (#1919) * class overrides equals() and should therefore also override hashCode() * #1862 add modify user in process difinition list * #1862 add pg-1.2.2 ddl.sql * modify ScriptRunnerTest * add updateProessDifinition UT * modify updateProcessDifinition UT * modify updateProcessDifinition UT * modify mysql 1.2.2 ddl.sql&dml.sql * add scope test to mysql in pom * modify pg-1.2.2 ddl.sql * refactor module * updates Co-authored-by: khadgarmage <khadgar.mage@outlook.com> Co-authored-by: zhukai <boness@qq.com> Co-authored-by: Yelli <amarantine@my.com>pull/2/head
Tboy
5 years ago
committed by
GitHub
95 changed files with 788 additions and 865 deletions
@ -0,0 +1,66 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
package org.apache.dolphinscheduler.common.utils; |
||||
|
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class StringUtilsTest { |
||||
@Test |
||||
public void testIsNotEmpty() { |
||||
//null string
|
||||
boolean b = StringUtils.isNotEmpty(null); |
||||
Assert.assertFalse(b); |
||||
|
||||
//"" string
|
||||
b = StringUtils.isNotEmpty(""); |
||||
Assert.assertFalse(b); |
||||
|
||||
//" " string
|
||||
b = StringUtils.isNotEmpty(" "); |
||||
Assert.assertTrue(b); |
||||
|
||||
//"test" string
|
||||
b = StringUtils.isNotEmpty("test"); |
||||
Assert.assertTrue(b); |
||||
} |
||||
|
||||
@Test |
||||
public void testIsNotBlank() { |
||||
//null string
|
||||
boolean b = StringUtils.isNotBlank(null); |
||||
Assert.assertFalse(b); |
||||
|
||||
//"" string
|
||||
b = StringUtils.isNotBlank(""); |
||||
Assert.assertFalse(b); |
||||
|
||||
//" " string
|
||||
b = StringUtils.isNotBlank(" "); |
||||
Assert.assertFalse(b); |
||||
|
||||
//" test " string
|
||||
b = StringUtils.isNotBlank(" test "); |
||||
Assert.assertTrue(b); |
||||
|
||||
//"test" string
|
||||
b = StringUtils.isNotBlank("test"); |
||||
Assert.assertTrue(b); |
||||
} |
||||
} |
@ -1,55 +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. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.service; |
||||
|
||||
import org.apache.dolphinscheduler.remote.command.Command; |
||||
import org.apache.dolphinscheduler.remote.command.CommandType; |
||||
import org.apache.dolphinscheduler.remote.utils.FastJsonSerializer; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* view log response command |
||||
*/ |
||||
public class MasterResponseCommand implements Serializable { |
||||
|
||||
private String msg; |
||||
|
||||
public MasterResponseCommand() { |
||||
} |
||||
|
||||
public MasterResponseCommand(String msg) { |
||||
this.msg = msg; |
||||
} |
||||
|
||||
public String getMsg() { |
||||
return msg; |
||||
} |
||||
|
||||
public void setMsg(String msg) { |
||||
this.msg = msg; |
||||
} |
||||
|
||||
public Command convert2Command(long opaque){ |
||||
Command command = new Command(opaque); |
||||
command.setType(CommandType.MASTER_RESPONSE); |
||||
byte[] body = FastJsonSerializer.serialize(this); |
||||
command.setBody(body); |
||||
return command; |
||||
} |
||||
} |
@ -1,58 +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. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.service; |
||||
|
||||
import org.apache.dolphinscheduler.remote.command.Command; |
||||
import org.apache.dolphinscheduler.remote.command.CommandType; |
||||
import org.apache.dolphinscheduler.remote.utils.FastJsonSerializer; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.concurrent.atomic.AtomicLong; |
||||
|
||||
/** |
||||
* view log request command |
||||
*/ |
||||
public class WorkerRequestCommand implements Serializable { |
||||
|
||||
private static final AtomicLong REQUEST = new AtomicLong(1); |
||||
|
||||
private String path; |
||||
|
||||
public WorkerRequestCommand() { |
||||
} |
||||
|
||||
public WorkerRequestCommand(String path) { |
||||
this.path = path; |
||||
} |
||||
|
||||
public String getPath() { |
||||
return path; |
||||
} |
||||
|
||||
public void setPath(String path) { |
||||
this.path = path; |
||||
} |
||||
|
||||
public Command convert2Command(){ |
||||
Command command = new Command(REQUEST.getAndIncrement()); |
||||
command.setType(CommandType.WORKER_REQUEST); |
||||
byte[] body = FastJsonSerializer.serialize(this); |
||||
command.setBody(body); |
||||
return command; |
||||
} |
||||
} |
@ -1,107 +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. |
||||
*/ |
||||
package org.apache.dolphinscheduler.service.worker; |
||||
|
||||
import io.netty.channel.Channel; |
||||
import org.apache.dolphinscheduler.remote.NettyRemotingClient; |
||||
import org.apache.dolphinscheduler.remote.command.Command; |
||||
import org.apache.dolphinscheduler.remote.command.CommandType; |
||||
import org.apache.dolphinscheduler.remote.command.log.*; |
||||
import org.apache.dolphinscheduler.remote.config.NettyClientConfig; |
||||
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; |
||||
import org.apache.dolphinscheduler.remote.utils.Address; |
||||
import org.apache.dolphinscheduler.remote.utils.FastJsonSerializer; |
||||
import org.apache.dolphinscheduler.service.MasterResponseCommand; |
||||
import org.apache.dolphinscheduler.service.WorkerRequestCommand; |
||||
import org.apache.dolphinscheduler.service.log.LogPromise; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
|
||||
/** |
||||
* log client |
||||
*/ |
||||
public class WorkerClientService implements NettyRequestProcessor { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WorkerClientService.class); |
||||
|
||||
private final NettyClientConfig clientConfig; |
||||
|
||||
private final NettyRemotingClient client; |
||||
|
||||
private final Address address; |
||||
|
||||
/** |
||||
* request time out |
||||
*/ |
||||
private final long logRequestTimeout = 10 * 1000; |
||||
|
||||
/** |
||||
* construct client |
||||
* @param host host |
||||
* @param port port |
||||
*/ |
||||
public WorkerClientService(String host, int port) { |
||||
this.address = new Address(host, port); |
||||
this.clientConfig = new NettyClientConfig(); |
||||
this.clientConfig.setWorkerThreads(1); |
||||
this.client = new NettyRemotingClient(clientConfig); |
||||
this.client.registerProcessor(CommandType.MASTER_RESPONSE, this); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* shutdown |
||||
*/ |
||||
public void shutdown() { |
||||
this.client.close(); |
||||
logger.info("logger client shutdown"); |
||||
} |
||||
|
||||
|
||||
public String reportResult() { |
||||
WorkerRequestCommand request = new WorkerRequestCommand(); |
||||
String result = ""; |
||||
try { |
||||
Command command = request.convert2Command(); |
||||
this.client.send(address, command); |
||||
LogPromise promise = new LogPromise(command.getOpaque(), logRequestTimeout); |
||||
result = ((String)promise.getResult()); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
logger.error("roll view log error", e); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void process(Channel channel, Command command) { |
||||
logger.info("received log response : {}", command); |
||||
MasterResponseCommand masterResponseCommand = FastJsonSerializer.deserialize( |
||||
command.getBody(), MasterResponseCommand.class); |
||||
LogPromise.notify(command.getOpaque(), masterResponseCommand.getMsg()); |
||||
} |
||||
|
||||
public static void main(String[] args) throws Exception{ |
||||
WorkerClientService workerClientService = new WorkerClientService("192.168.220.247", 1128); |
||||
String result = workerClientService.reportResult(); |
||||
System.out.println(result); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
|
||||
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
||||
-- uc_dolphin_T_t_ds_process_definition_A_modify_by |
||||
drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_definition_A_modify_by; |
||||
delimiter d// |
||||
CREATE PROCEDURE uc_dolphin_T_t_ds_process_definition_A_modify_by() |
||||
BEGIN |
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
||||
WHERE TABLE_NAME='t_ds_process_definition' |
||||
AND TABLE_SCHEMA=(SELECT DATABASE()) |
||||
AND COLUMN_NAME ='modify_by') |
||||
THEN |
||||
ALTER TABLE t_ds_process_definition ADD `modify_by` varchar(36) DEFAULT '' COMMENT 'modify user'; |
||||
END IF; |
||||
END; |
||||
|
||||
d// |
||||
|
||||
delimiter ; |
||||
CALL uc_dolphin_T_t_ds_process_definition_A_modify_by; |
||||
DROP PROCEDURE uc_dolphin_T_t_ds_process_definition_A_modify_by; |
@ -0,0 +1,34 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
-- uc_dolphin_T_t_ds_process_definition_A_modify_by |
||||
delimiter d// |
||||
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_process_definition_A_modify_by() RETURNS void AS $$ |
||||
BEGIN |
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS |
||||
WHERE TABLE_NAME='t_ds_process_definition' |
||||
AND COLUMN_NAME ='modify_by') |
||||
THEN |
||||
ALTER TABLE t_ds_process_definition ADD COLUMN modify_by varchar(36) DEFAULT ''; |
||||
END IF; |
||||
END; |
||||
$$ LANGUAGE plpgsql; |
||||
d// |
||||
|
||||
delimiter ; |
||||
SELECT uc_dolphin_T_t_ds_process_definition_A_modify_by(); |
||||
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_process_definition_A_modify_by(); |
||||
|
Loading…
Reference in new issue