Browse Source
* Enhance using experience of DataX by introduce TIS [Feature-5992] * Enhance using experience of DataX by introduce TIS [Feature-5992] * fix stylecheck error * make testCase pass * make dev testCase pass * add new java dependency Java-WebSocket * modfiy TISParameters.java avoid to name confliction * add InterruptedException checking * reAdd async-http-client annotation * in order to staisfy the coverage degree add test which has been removed * make testCase pass * make testCase pass * add jacoco dependency * make code duplications be more lower * add Java-WebSocket dependency in root pom * remove useless code comment * make tis http apply path and post body configurable ,the params save in config.properites * Remove the dangerous instance of double-checked locking2.0.7-release
百岁
3 years ago
committed by
GitHub
19 changed files with 428 additions and 108 deletions
@ -0,0 +1,58 @@
|
||||
/* |
||||
* 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.task.tis; |
||||
|
||||
import org.apache.dolphinscheduler.common.process.ResourceInfo; |
||||
import org.apache.dolphinscheduler.common.task.AbstractParameters; |
||||
import org.apache.dolphinscheduler.spi.utils.StringUtils; |
||||
|
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
/** |
||||
* TIS parameter |
||||
*/ |
||||
public class TISCommonParameters extends AbstractParameters { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TISCommonParameters.class); |
||||
/** |
||||
* TIS target job name |
||||
*/ |
||||
private String jobName; |
||||
|
||||
public String getTargetJobName() { |
||||
return jobName; |
||||
} |
||||
|
||||
public void setTargetJobName(String jobName) { |
||||
this.jobName = jobName; |
||||
} |
||||
|
||||
@Override |
||||
public boolean checkParameters() { |
||||
return StringUtils.isNotBlank(this.jobName); |
||||
} |
||||
|
||||
@Override |
||||
public List<ResourceInfo> getResourceFilesList() { |
||||
return Collections.emptyList(); |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
Copyright (c) 2010-2020 Nathan Rajlich |
||||
|
||||
Permission is hereby granted, free of charge, to any person |
||||
obtaining a copy of this software and associated documentation |
||||
files (the "Software"), to deal in the Software without |
||||
restriction, including without limitation the rights to use, |
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following |
||||
conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be |
||||
included in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
||||
OTHER DEALINGS IN THE SOFTWARE. |
@ -0,0 +1,85 @@
|
||||
/* |
||||
* 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.plugin.task.tis; |
||||
|
||||
import org.apache.dolphinscheduler.spi.utils.StringUtils; |
||||
|
||||
import java.util.ResourceBundle; |
||||
|
||||
public class TISConfig { |
||||
|
||||
private static TISConfig cfg; |
||||
|
||||
private final String jobTriggerUrl; |
||||
private final String jobTriggerPostBody; |
||||
private final String jobStatusUrl; |
||||
private final String jobStatusPostBody; |
||||
|
||||
private final String jobLogsFetchUrl; |
||||
private final String jobCancelPostBody; |
||||
|
||||
public static synchronized TISConfig getInstance() { |
||||
if (cfg == null) { |
||||
cfg = new TISConfig(); |
||||
} |
||||
return cfg; |
||||
} |
||||
|
||||
private TISConfig() { |
||||
ResourceBundle bundle = ResourceBundle.getBundle(TISConfig.class.getPackage().getName().replace(".", "/") + "/config"); |
||||
this.jobTriggerUrl = bundle.getString("job.trigger.url"); |
||||
this.jobStatusUrl = bundle.getString("job.status.url"); |
||||
this.jobTriggerPostBody = bundle.getString("job.trigger.post.body"); |
||||
this.jobStatusPostBody = bundle.getString("job.status.post.body"); |
||||
this.jobLogsFetchUrl = bundle.getString("job.logs.fetch.url"); |
||||
this.jobCancelPostBody = bundle.getString("job.cancel.post.body"); |
||||
} |
||||
|
||||
public String getJobCancelPostBody(int taskId) { |
||||
return String.format(jobCancelPostBody, taskId); |
||||
} |
||||
|
||||
public String getJobTriggerUrl(String tisHost) { |
||||
checkTisHost(tisHost); |
||||
return String.format(this.jobTriggerUrl, tisHost); |
||||
} |
||||
|
||||
public String getJobTriggerPostBody() { |
||||
return jobTriggerPostBody; |
||||
} |
||||
|
||||
public String getJobStatusPostBody(int taskId) { |
||||
return String.format(jobStatusPostBody, taskId); |
||||
} |
||||
|
||||
public String getJobLogsFetchUrl(String tisHost, String jobName, int taskId) { |
||||
checkTisHost(tisHost); |
||||
return String.format(jobLogsFetchUrl, tisHost, jobName, taskId); |
||||
} |
||||
|
||||
public String getJobStatusUrl(String tisHost) { |
||||
checkTisHost(tisHost); |
||||
return String.format(this.jobStatusUrl, tisHost); |
||||
} |
||||
|
||||
private static void checkTisHost(String tisHost) { |
||||
if (StringUtils.isBlank(tisHost)) { |
||||
throw new IllegalArgumentException("param tisHost can not be null"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* 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.plugin.task.tis; |
||||
|
||||
import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; |
||||
import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; |
||||
|
||||
import com.google.common.collect.ImmutableList; |
||||
|
||||
public class TISTaskPlugin implements DolphinSchedulerPlugin { |
||||
|
||||
@Override |
||||
public Iterable<TaskChannelFactory> getTaskChannelFactorys() { |
||||
return ImmutableList.of(new TISTaskChannelFactory()); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
job.trigger.url=http://%s/tjs/coredefine/coredefine.ajax |
||||
job.trigger.post.body=action=datax_action&emethod=trigger_fullbuild_task |
||||
|
||||
job.cancel.post.body=action=core_action&event_submit_do_cancel_task=y&taskid=%s |
||||
|
||||
job.status.url=http://%s/tjs/config/config.ajax?action=collection_action&emethod=get_task_status |
||||
job.status.post.body={\n taskid: %s\n, log: false } |
||||
|
||||
job.logs.fetch.url=ws://%s/tjs/download/logfeedback?logtype=full&collection=%s&taskid=%s |
Loading…
Reference in new issue