Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@

package org.apache.linkis.common.utils;

import org.apache.commons.lang3.StringUtils;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;

public class SHAUtils {

Expand Down Expand Up @@ -65,35 +60,4 @@ public static String bytes2Hex(byte[] bts) {
}
return des;
}

public static void main(String[] args) throws IOException {
String applicationId = args[0];
String app_id = args[1];
String token = args[2];
String nonce = args[3];
if (StringUtils.isBlank(applicationId)) {
throw new LinkageError("Invalid applicationId cannot be empty");
}
if (StringUtils.isBlank(app_id)) {
throw new LinkageError("Invalid app_id cannot be empty");
}
if (StringUtils.isBlank(token)) {
throw new LinkageError("Invalid token cannot be empty");
}
if (StringUtils.isBlank(nonce)) {
throw new LinkageError("Invalid nonce cannot be empty");
}
Map<String, String> parms = new HashMap<>();
String timestampStr = String.valueOf(System.currentTimeMillis());
parms.put("applicationId", applicationId);
parms.put("app_id", app_id);
parms.put("timestamp", timestampStr);
parms.put("nonce", nonce);
if (StringUtils.isNotBlank(token)) {
String signature =
Encrypt(Encrypt(parms.get("app_id") + nonce + timestampStr, null) + token, null);
parms.put("signature", signature);
}
System.out.println(parms);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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.linkis.common.utils;

import org.apache.commons.lang3.StringUtils;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

import org.junit.jupiter.api.Test;

class ShaUtilsTest {
@Test
void encryptTest() throws UnsupportedEncodingException {
String applicationId = "test_application_id";
String app_id = "test_app_id";
String token = "test_token";
String nonce = "123456";
if (StringUtils.isBlank(applicationId)) {
throw new LinkageError("Invalid applicationId cannot be empty");
}
if (StringUtils.isBlank(app_id)) {
throw new LinkageError("Invalid app_id cannot be empty");
}
if (StringUtils.isBlank(token)) {
throw new LinkageError("Invalid token cannot be empty");
}
if (StringUtils.isBlank(nonce)) {
throw new LinkageError("Invalid nonce cannot be empty");
}
Map<String, String> parms = new HashMap<>();
String timestampStr = String.valueOf(System.currentTimeMillis());
parms.put("applicationId", applicationId);
parms.put("app_id", app_id);
parms.put("timestamp", timestampStr);
parms.put("nonce", nonce);
if (StringUtils.isNotBlank(token)) {
String signature =
SHAUtils.Encrypt(
SHAUtils.Encrypt(parms.get("app_id") + nonce + timestampStr, null) + token, null);
parms.put("signature", signature);
}
}
}
19 changes: 15 additions & 4 deletions linkis-commons/linkis-hadoop-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
~ 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.
Expand Down Expand Up @@ -56,12 +56,23 @@

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>${hadoop-hdfs-client.artifact}</artifactId>
<artifactId>hadoop-auth</artifactId>
</dependency>

<!-- HDFS 依赖: 通过 scope 变量控制,3.x 使用 hadoop-hdfs-client,2.x 使用 hadoop-hdfs -->
<!-- hadoop-hdfs-client 在 2.x 中不存在,父 pom 中通过单独版本变量保持使用 3.3.4 -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
<artifactId>hadoop-hdfs-client</artifactId>
<scope>${hadoop-hdfs-client.scope}</scope>
</dependency>

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<scope>${hadoop-hdfs.scope}</scope>
</dependency>

<!-- Common Logging 桥接 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
4 changes: 2 additions & 2 deletions linkis-commons/linkis-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>${woodstox.core.version}</version>
<version>${woodstox.version}</version>
</dependency>

<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>${jettision.version}</version>
<version>${jettison.version}</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
* 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
*
*
* 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.linkis.protocol

Expand Down
1 change: 0 additions & 1 deletion linkis-commons/linkis-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aliyun</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
Expand Down Expand Up @@ -60,7 +61,9 @@ public String getDefaultFolderPerm() {

public abstract long getBlockSize(FsPath dest) throws IOException;

public abstract List<FsPath> getAllFilePaths(FsPath dest) throws IOException;
public List<FsPath> getAllFilePaths(FsPath dest) throws IOException {
return new ArrayList<>();
}

public abstract boolean canExecute(FsPath dest) throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,16 @@ public String getChecksum(FsPath dest) throws IOException {
return null;
}

@Override
public String getChecksumWithMD5(FsPath dest) throws IOException {
return null;
}

@Override
public long getBlockSize(FsPath dest) throws IOException {
return 0L;
}

@Override
public boolean canExecute(FsPath dest) throws IOException {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ public long getLength(FsPath dest) throws IOException {
return 0;
}

@Override
public String getChecksumWithMD5(FsPath dest) throws IOException {
return null;
}

@Override
public String getChecksum(FsPath dest) throws IOException {
return null;
}

@Override
public long getBlockSize(FsPath dest) throws IOException {
return 0L;
}

@Override
public boolean canExecute(FsPath dest) throws IOException {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,21 @@ public long getLength(FsPath dest) throws IOException {
.getContentLength();
}

@Override
public String getChecksumWithMD5(FsPath dest) throws IOException {
return null;
}

@Override
public String getChecksum(FsPath dest) throws IOException {
return null;
}

@Override
public long getBlockSize(FsPath dest) throws IOException {
return 0L;
}

@Override
public boolean canExecute(FsPath dest) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ object FileSystemUtils extends Logging {
true
}


/**
* Recursively create a directory(递归创建目录) 默认添加 Owner 信息
* @param fileSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class EngineConnYarnLogOperator extends EngineConnLogOperator {
}

override def getLogPath(implicit parameters: Map[String, Any]): File = {
val applicationId = getAsThrow[String]("yarnApplicationId")
val applicationId = getAsThrow[String]("yarnApplicationId", parameters)
val (ticketId, engineConnInstance, engineConnLogDir) = getEngineConnInfo(parameters)
val rootLogPath = EngineConnYarnLogOperator.YARN_LOG_STORAGE_PATH.getValue match {
case storePath if StringUtils.isNotBlank(storePath) =>
Expand Down
7 changes: 7 additions & 0 deletions linkis-computation-governance/linkis-entrance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-ps-common-lock</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.linkis.entrance.scheduler;

import org.apache.linkis.scheduler.queue.Group;
import org.apache.linkis.scheduler.queue.fifoqueue.FIFOUserConsumer;
import org.apache.linkis.scheduler.queue.parallelqueue.ParallelConsumerManager;

public class EntranceParallelConsumerManager extends ParallelConsumerManager {

public EntranceParallelConsumerManager(int maxParallelismUsers, String schedulerName) {
super(maxParallelismUsers, schedulerName);
}

@Override
public FIFOUserConsumer createConsumer(String groupName) {
Group group = getSchedulerContext().getOrCreateGroupFactory().getGroup(groupName);
return new EntranceFIFOUserConsumer(getSchedulerContext(), getOrCreateExecutorService(), group);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ import org.apache.linkis.common.exception.ErrorException
import org.apache.linkis.common.log.LogUtils
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.entrance.conf.EntranceConfiguration
import org.apache.linkis.entrance.conf.EntranceConfiguration.PYTHON_SAFE_CHECK_SWITCH
import org.apache.linkis.entrance.exception.{EntranceErrorCode, EntranceIllegalParamException}
import org.apache.linkis.entrance.interceptor.exception.{
PythonCodeCheckException,
ScalaCodeCheckException
}
import org.apache.linkis.entrance.utils.SafeUtils
import org.apache.linkis.governance.common.entity.job.JobRequest

import org.apache.commons.lang3.StringUtils
Expand Down
Loading
Loading