From ae2f45d31abd216993eb1f9e1bb1c93ef4e8f873 Mon Sep 17 00:00:00 2001 From: peacewong Date: Tue, 19 Sep 2023 16:33:10 +0800 Subject: [PATCH 01/14] update log of match error code to error level --- .../org/apache/linkis/common/log/LogUtils.scala | 5 ++++- .../apache/linkis/entrance/log/LogManager.scala | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala index 77c82f3883..217df16488 100644 --- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala +++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala @@ -33,7 +33,7 @@ object LogUtils { } def generateERROR(rawLog: String): String = { - getTimeFormat + " " + "ERROR" + " " + rawLog + getTimeFormat + " " + ERROR_STR + " " + rawLog } def generateWarn(rawLog: String): String = { @@ -52,4 +52,7 @@ object LogUtils { getTimeFormat + " " + "SYSTEM-WARN" + " " + rawLog } + val ERROR_STR = "ERROR" + + } diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogManager.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogManager.scala index 626a643a0b..6a9372099b 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogManager.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/LogManager.scala @@ -17,6 +17,7 @@ package org.apache.linkis.entrance.log +import org.apache.linkis.common.log.LogUtils import org.apache.linkis.common.utils.{Logging, Utils} import org.apache.linkis.entrance.EntranceContext import org.apache.linkis.entrance.job.EntranceExecutionJob @@ -59,10 +60,19 @@ abstract class LogManager extends LogListener with Logging { } } } - entranceExecutionJob.getLogWriter.foreach(logWriter => logWriter.write(log)) - errorCodeManager.foreach(_.errorMatch(log).foreach { case (code, errorMsg) => - errorCodeListener.foreach(_.onErrorCodeCreated(job, code, errorMsg)) + var writeLog = log + errorCodeManager.foreach(_.errorMatch(log).foreach { + case (code, errorMsg) => + if (!writeLog.contains(LogUtils.ERROR_STR)) { + writeLog = LogUtils.generateERROR(log + "\n") + LogUtils.generateERROR( + s"error code: $code, errorMsg: $errorMsg" + ) + } + errorCodeListener.foreach(_.onErrorCodeCreated(job, code, errorMsg)) + case _ => }) + entranceExecutionJob.getLogWriter.foreach(logWriter => logWriter.write(writeLog)) + case _ => } } { From dd2598347ac13837512158836dad862b0b9b9acb Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Wed, 20 Sep 2023 11:17:20 +0800 Subject: [PATCH 02/14] fix conf error --- .../linkis/common/conf/BDPConfiguration.scala | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/conf/BDPConfiguration.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/conf/BDPConfiguration.scala index 14febab63a..592b5279d4 100644 --- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/conf/BDPConfiguration.scala +++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/conf/BDPConfiguration.scala @@ -232,19 +232,20 @@ private[conf] object BDPConfiguration extends Logging { private[common] def formatValue[T](defaultValue: T, value: Option[String]): Option[T] = { if (value.isEmpty || value.exists(StringUtils.isEmpty)) return Option(defaultValue) + val trimValue = value.map(_.trim) val formattedValue = defaultValue match { - case _: String => value - case _: Byte => value.map(_.toByte) - case _: Short => value.map(_.toShort) - case _: Char => value.map(_.toCharArray.apply(0)) - case _: Int => value.map(_.toInt) - case _: Long => value.map(_.toLong) - case _: Float => value.map(_.toFloat) - case _: Double => value.map(_.toDouble) - case _: Boolean => value.map(_.toBoolean) - case _: TimeType => value.map(new TimeType(_)) - case _: ByteType => value.map(new ByteType(_)) - case null => value + case _: String => trimValue + case _: Byte => trimValue.map(_.trim).map(_.toByte) + case _: Short => trimValue.map(_.toShort) + case _: Char => trimValue.map(_.toCharArray.apply(0)) + case _: Int => trimValue.map(_.toInt) + case _: Long => trimValue.map(_.toLong) + case _: Float => trimValue.map(_.toFloat) + case _: Double => trimValue.map(_.toDouble) + case _: Boolean => trimValue.map(_.toBoolean) + case _: TimeType => trimValue.map(new TimeType(_)) + case _: ByteType => trimValue.map(new ByteType(_)) + case null => trimValue } formattedValue.asInstanceOf[Option[T]] } From bbce1ae19dddc0b65b1535684473e30c4624c52d Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Thu, 21 Sep 2023 15:19:00 +0800 Subject: [PATCH 03/14] update engine error msg --- .../org/apache/linkis/manager/am/restful/EMRestfulApi.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java index d21a6631a4..e575556978 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java @@ -436,6 +436,10 @@ public Message openEngineLog(HttpServletRequest req, @RequestBody JsonNode jsonN private Message executeECMOperation( EMNode ecmNode, String engineInstance, ECMOperateRequest ecmOperateRequest) { + if (Objects.isNull(ecmNode)) { + return Message.error( + "ECM node :" + engineInstance + " does not exist, Unable to open engine log"); + } String operationName = OperateRequest$.MODULE$.getOperationName(ecmOperateRequest.parameters()); String userName = ecmOperateRequest.user(); if (ArrayUtils.contains(adminOperations, operationName) && Configuration.isNotAdmin(userName)) { From d4ac5b5de104ec0a0a5ec227d531c58f77edde40 Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Thu, 21 Sep 2023 15:41:48 +0800 Subject: [PATCH 04/14] update engine error msg --- .../org/apache/linkis/manager/am/restful/EMRestfulApi.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java index e575556978..8e74582173 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java @@ -438,7 +438,9 @@ private Message executeECMOperation( EMNode ecmNode, String engineInstance, ECMOperateRequest ecmOperateRequest) { if (Objects.isNull(ecmNode)) { return Message.error( - "ECM node :" + engineInstance + " does not exist, Unable to open engine log"); + "ECM node :" + + engineInstance.split(":")[0] + + " does not exist, Unable to open engine log"); } String operationName = OperateRequest$.MODULE$.getOperationName(ecmOperateRequest.parameters()); String userName = ecmOperateRequest.user(); From bad60fc9e197f6afd7bbd8470ecfc50fa1e2f783 Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Thu, 21 Sep 2023 16:26:59 +0800 Subject: [PATCH 05/14] update engine error msg --- .../apache/linkis/manager/am/restful/EMRestfulApi.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java index 8e74582173..d85eba6f89 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java @@ -438,9 +438,11 @@ private Message executeECMOperation( EMNode ecmNode, String engineInstance, ECMOperateRequest ecmOperateRequest) { if (Objects.isNull(ecmNode)) { return Message.error( - "ECM node :" - + engineInstance.split(":")[0] - + " does not exist, Unable to open engine log"); + "ECM node :[" + + engineInstance + + "] does not exist, Unable to open engine log(ECM节点:[" + + engineInstance + + "] 异常,无法打开日志,可能是该节点服务重启或则服务异常导致)"); } String operationName = OperateRequest$.MODULE$.getOperationName(ecmOperateRequest.parameters()); String userName = ecmOperateRequest.user(); From a1f50e1c27aa1a8f1340dff3b1b043e7831a3725 Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Fri, 22 Sep 2023 15:48:03 +0800 Subject: [PATCH 06/14] update hive log4j conf --- linkis-engineconn-plugins/hive/src/main/resources/log4j2.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/linkis-engineconn-plugins/hive/src/main/resources/log4j2.xml b/linkis-engineconn-plugins/hive/src/main/resources/log4j2.xml index b56efdb366..d9790df2cc 100644 --- a/linkis-engineconn-plugins/hive/src/main/resources/log4j2.xml +++ b/linkis-engineconn-plugins/hive/src/main/resources/log4j2.xml @@ -36,6 +36,7 @@ + From 8c6c3410a2a33f2fbbaf65cc7f16204bb7d826e2 Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Mon, 25 Sep 2023 15:34:07 +0800 Subject: [PATCH 07/14] code opmizition --- .../restful/api/QueryRestfulApi.java | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java index ff5a912702..cbd1729ebf 100644 --- a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java +++ b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java @@ -232,14 +232,14 @@ public Message list( /** Method list should not contain subjob, which may cause performance problems. */ @ApiOperation(value = "listundonetasks", notes = "list undone tasks", response = Message.class) @ApiImplicitParams({ - @ApiImplicitParam(name = "startDate", dataType = "long"), - @ApiImplicitParam(name = "endDate", required = false, dataType = "long", value = "end date"), - @ApiImplicitParam(name = "status", required = false, dataType = "String", value = "status"), - @ApiImplicitParam(name = "pageNow", required = false, dataType = "Integer", value = "page now"), - @ApiImplicitParam(name = "pageSize", dataType = "Integer"), - @ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator"), - @ApiImplicitParam(name = "engineType", dataType = "String"), - @ApiImplicitParam(name = "startTaskID", dataType = "long"), + @ApiImplicitParam(name = "startDate", required = false, dataType = "Long", value = "start date"), + @ApiImplicitParam(name = "endDate", required = false, dataType = "Long", value = "end date"), + @ApiImplicitParam(name = "status", required = false, dataType = "String", value = "status"), + @ApiImplicitParam(name = "pageNow", required = false, dataType = "Integer", value = "page now"), + @ApiImplicitParam(name = "pageSize", required = false, dataType = "Integer", value = "page size"), + @ApiImplicitParam(name = "startTaskID", required = false, dataType = "Long", value = "start task id"), + @ApiImplicitParam(name = "engineType", required = false, dataType = "String", value = "engine type"), + @ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator") }) @RequestMapping(path = "/listundonetasks", method = RequestMethod.GET) public Message listundonetasks( @@ -326,13 +326,29 @@ public Message listundonetasks( @ApiOperation(value = "listundone", notes = "list undone", response = Message.class) @ApiImplicitParams({ - @ApiImplicitParam(name = "startDate", dataType = "long"), - @ApiImplicitParam(name = "endDate", required = false, dataType = "long", value = "end date"), - @ApiImplicitParam(name = "status", required = false, dataType = "String", value = "status"), + @ApiImplicitParam( + name = "startDate", + required = false, + dataType = "Long", + value = "start date"), + @ApiImplicitParam(name = "endDate", required = false, dataType = "Long", value = "end date"), @ApiImplicitParam(name = "pageNow", required = false, dataType = "Integer", value = "page now"), - @ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator"), - @ApiImplicitParam(name = "engineType", dataType = "String"), - @ApiImplicitParam(name = "startTaskID", dataType = "long"), + @ApiImplicitParam( + name = "pageSize", + required = false, + dataType = "Integer", + value = "page size"), + @ApiImplicitParam( + name = "startTaskID", + required = false, + dataType = "Long", + value = "startTaskID"), + @ApiImplicitParam( + name = "engineType", + required = false, + dataType = "String", + value = "engineType"), + @ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator") }) /** Method list should not contain subjob, which may cause performance problems. */ @RequestMapping(path = "/listundone", method = RequestMethod.GET) @@ -355,17 +371,13 @@ public Message listundone( } if (StringUtils.isEmpty(creator)) { creator = null; - } else { - if (!QueryUtils.checkNameValid(creator)) { - return Message.error("Invalid creator : " + creator); - } + } else if (!QueryUtils.checkNameValid(creator)) { + return Message.error("Invalid creator : " + creator); } if (StringUtils.isEmpty(engineType)) { engineType = null; - } else { - if (!QueryUtils.checkNameValid(engineType)) { - return Message.error("Invalid engienType: " + engineType); - } + } else if (!QueryUtils.checkNameValid(engineType)) { + return Message.error("Invalid engienType: " + engineType); } Date sDate = new Date(startDate); Date eDate = new Date(endDate); From 5070bff6d28a0914d41280ede6c2f139db59b5a9 Mon Sep 17 00:00:00 2001 From: aiceflower Date: Tue, 26 Sep 2023 16:54:02 +0800 Subject: [PATCH 08/14] Update vertion to 1.1.16-wedatasphere --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5865c9cee4..0bee4d4b07 100644 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ - 1.1.15-wedatasphere + 1.1.16-wedatasphere 2.9.2 2.4.3 2.7.2 From 4c32742de979ca6a4092d186cdd52a0d763d8be9 Mon Sep 17 00:00:00 2001 From: aiceflower Date: Tue, 26 Sep 2023 17:41:14 +0800 Subject: [PATCH 09/14] update setOwner --- .../apache/linkis/common/log/LogUtils.scala | 1 - .../storage/utils/FileSystemUtils.scala | 50 ++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala index 217df16488..e558e765be 100644 --- a/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala +++ b/linkis-commons/linkis-common/src/main/scala/org/apache/linkis/common/log/LogUtils.scala @@ -54,5 +54,4 @@ object LogUtils { val ERROR_STR = "ERROR" - } diff --git a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala index 5252c12e03..1f1ffb9edb 100644 --- a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala +++ b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala @@ -57,10 +57,11 @@ object FileSystemUtils extends Logging { val fileSystem = FSFactory.getFsByProxyUser(filePath, user).asInstanceOf[FileSystem] Utils.tryFinally { fileSystem.init(null) - createNewFileWithFileSystem(fileSystem, filePath, user, createParentWhenNotExists) + createFileWithFileSystem(fileSystem, filePath, user, createParentWhenNotExists) }(Utils.tryQuietly(fileSystem.close())) } + @deprecated("please use createFileWithFileSystem") def createNewFileWithFileSystem( fileSystem: FileSystem, filePath: FsPath, @@ -82,6 +83,24 @@ object FileSystemUtils extends Logging { } } + def createFileWithFileSystem( + fileSystem: FileSystem, + filePath: FsPath, + user: String, + createParentWhenNotExists: Boolean + ): Unit = { + if (!fileSystem.exists(filePath)) { + if (!fileSystem.exists(filePath.getParent)) { + if (!createParentWhenNotExists) { + throw new IOException("parent dir " + filePath.getParent.getPath + " dose not exists.") + } + mkdirsNew(fileSystem, filePath.getParent, user) + } + fileSystem.createNewFile(filePath) + fileSystem.setOwner(filePath, user) + } + } + /** * Recursively create a directory(递归创建目录) * @param fileSystem @@ -91,6 +110,7 @@ object FileSystemUtils extends Logging { * @return */ @throws[IOException] + @deprecated("please use mkdirsNew") def mkdirs(fileSystem: FileSystem, dest: FsPath, user: String): Boolean = { var parentPath = dest.getParent val dirsToMake = new util.Stack[FsPath]() @@ -113,4 +133,32 @@ object FileSystemUtils extends Logging { true } + /** + * Recursively create a directory(递归创建目录) 默认添加setOwner + * @param fileSystem + * @param dest + * @param user + * @throws + * @return + */ + @throws[IOException] + def mkdirsNew(fileSystem: FileSystem, dest: FsPath, user: String): Boolean = { + var parentPath = dest.getParent + val dirsToMake = new util.Stack[FsPath]() + dirsToMake.push(dest) + while (!fileSystem.exists(parentPath)) { + dirsToMake.push(parentPath) + parentPath = parentPath.getParent + } + if (!fileSystem.canExecute(parentPath)) { + throw new IOException("You have not permission to access path " + dest.getPath) + } + while (!dirsToMake.empty()) { + val path = dirsToMake.pop() + fileSystem.mkdir(path) + fileSystem.setOwner(path, user) + } + true + } + } From 487aa416809a2d255fbb3519fd768f2f9ff89eae Mon Sep 17 00:00:00 2001 From: aiceflower Date: Wed, 27 Sep 2023 14:11:47 +0800 Subject: [PATCH 10/14] update fun name --- .../apache/linkis/storage/utils/FileSystemUtils.scala | 11 +++++++++-- .../linkis/entrance/log/HDFSCacheLogWriter.scala | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala index 1f1ffb9edb..3eb234a964 100644 --- a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala +++ b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala @@ -57,7 +57,7 @@ object FileSystemUtils extends Logging { val fileSystem = FSFactory.getFsByProxyUser(filePath, user).asInstanceOf[FileSystem] Utils.tryFinally { fileSystem.init(null) - createFileWithFileSystem(fileSystem, filePath, user, createParentWhenNotExists) + createNewFileWithFileSystem(fileSystem, filePath, user, createParentWhenNotExists) }(Utils.tryQuietly(fileSystem.close())) } @@ -83,7 +83,14 @@ object FileSystemUtils extends Logging { } } - def createFileWithFileSystem( + /** + * create new file and set file owner by FileSystem + * @param fileSystem + * @param filePath + * @param user + * @param createParentWhenNotExists + */ + def createNewFileAndSetOwnerWithFileSystem( fileSystem: FileSystem, filePath: FsPath, user: String, diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala index a272f1e8a1..4f37ff1040 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala @@ -59,7 +59,12 @@ class HDFSCacheLogWriter(logPath: String, charset: String, sharedCache: Cache, u private def init(): Unit = { fileSystem.init(new util.HashMap[String, String]()) - FileSystemUtils.createNewFileWithFileSystem(fileSystem, new FsPath(logPath), user, true) + FileSystemUtils.createNewFileAndSetOwnerWithFileSystem( + fileSystem, + new FsPath(logPath), + user, + true + ) } @throws[IOException] From 129118e34bf16c46250f312e38032046bffa13fa Mon Sep 17 00:00:00 2001 From: aiceflower Date: Sat, 7 Oct 2023 11:01:47 +0800 Subject: [PATCH 11/14] update func name --- .../org/apache/linkis/storage/utils/FileSystemUtils.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala index 3eb234a964..5ea475f216 100644 --- a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala +++ b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala @@ -101,7 +101,7 @@ object FileSystemUtils extends Logging { if (!createParentWhenNotExists) { throw new IOException("parent dir " + filePath.getParent.getPath + " dose not exists.") } - mkdirsNew(fileSystem, filePath.getParent, user) + mkdirsAndSetOwner(fileSystem, filePath.getParent, user) } fileSystem.createNewFile(filePath) fileSystem.setOwner(filePath, user) @@ -141,7 +141,7 @@ object FileSystemUtils extends Logging { } /** - * Recursively create a directory(递归创建目录) 默认添加setOwner + * Recursively create a directory(递归创建目录) 默认添加 Owner 信息 * @param fileSystem * @param dest * @param user @@ -149,7 +149,7 @@ object FileSystemUtils extends Logging { * @return */ @throws[IOException] - def mkdirsNew(fileSystem: FileSystem, dest: FsPath, user: String): Boolean = { + def mkdirsAndSetOwner(fileSystem: FileSystem, dest: FsPath, user: String): Boolean = { var parentPath = dest.getParent val dirsToMake = new util.Stack[FsPath]() dirsToMake.push(dest) From 135c16859c79e1cdedbe810b924229d981613886 Mon Sep 17 00:00:00 2001 From: aiceflower Date: Sat, 7 Oct 2023 15:16:51 +0800 Subject: [PATCH 12/14] update deprecated desc --- .../org/apache/linkis/storage/utils/FileSystemUtils.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala index 5ea475f216..9c344fa802 100644 --- a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala +++ b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala @@ -61,7 +61,7 @@ object FileSystemUtils extends Logging { }(Utils.tryQuietly(fileSystem.close())) } - @deprecated("please use createFileWithFileSystem") + @deprecated("please use createNewFileAndSetOwnerWithFileSystem") def createNewFileWithFileSystem( fileSystem: FileSystem, filePath: FsPath, @@ -117,7 +117,7 @@ object FileSystemUtils extends Logging { * @return */ @throws[IOException] - @deprecated("please use mkdirsNew") + @deprecated("please use mkdirsAndSetOwner") def mkdirs(fileSystem: FileSystem, dest: FsPath, user: String): Boolean = { var parentPath = dest.getParent val dirsToMake = new util.Stack[FsPath]() From cc68e03ddea0e9aca2d858138351ff4e14f79129 Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Sat, 7 Oct 2023 17:37:39 +0800 Subject: [PATCH 13/14] formate code --- .../apache/linkis/manager/am/restful/EMRestfulApi.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java index d85eba6f89..9a4bbe961c 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java @@ -59,6 +59,7 @@ import javax.servlet.http.HttpServletRequest; +import java.text.MessageFormat; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -438,11 +439,9 @@ private Message executeECMOperation( EMNode ecmNode, String engineInstance, ECMOperateRequest ecmOperateRequest) { if (Objects.isNull(ecmNode)) { return Message.error( - "ECM node :[" - + engineInstance - + "] does not exist, Unable to open engine log(ECM节点:[" - + engineInstance - + "] 异常,无法打开日志,可能是该节点服务重启或则服务异常导致)"); + MessageFormat.format( + "ECM node :[{0}] does not exist, Unable to open engine log(ECM节点:[{1}] 异常,无法打开日志,可能是该节点服务重启或则服务异常导致)", + engineInstance, engineInstance)); } String operationName = OperateRequest$.MODULE$.getOperationName(ecmOperateRequest.parameters()); String userName = ecmOperateRequest.user(); From d22a35a4624c25808a7f02b16b24d833815000e6 Mon Sep 17 00:00:00 2001 From: v_kkhuang <420895376@qq.com> Date: Sat, 7 Oct 2023 18:37:47 +0800 Subject: [PATCH 14/14] update msg --- .../java/org/apache/linkis/manager/am/restful/EMRestfulApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java index 9a4bbe961c..2cb45b3cd8 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java @@ -440,7 +440,7 @@ private Message executeECMOperation( if (Objects.isNull(ecmNode)) { return Message.error( MessageFormat.format( - "ECM node :[{0}] does not exist, Unable to open engine log(ECM节点:[{1}] 异常,无法打开日志,可能是该节点服务重启或则服务异常导致)", + "ECM node :[{0}] does not exist, Unable to open engine log(ECM节点:[{1}] 异常,无法打开日志,可能是该节点服务重启或者服务异常导致)", engineInstance, engineInstance)); } String operationName = OperateRequest$.MODULE$.getOperationName(ecmOperateRequest.parameters());