Skip to content

Commit

Permalink
[optimize] Limits the log length that the ec sends to the entrance (#…
Browse files Browse the repository at this point in the history
…4831)

this close #4830
  • Loading branch information
guoshupei authored Jul 27, 2023
1 parent e49f26d commit 5c4e779
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ object ComputationExecutorConf {
val TASK_SUBMIT_WAIT_TIME_MS =
CommonVars("linkis.ec.task.submit.wait.time.ms", 2L, "Task submit wait time(ms)").getValue

val ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_ENABLED =
CommonVars("linkis.ec.send.log.entrance.limit.enabled", true)

val ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_LENGTH =
CommonVars("linkis.ec.send.log.entrance.limit.length", 2000)

}
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,16 @@ class EngineExecutionContext(executor: ComputationExecutor, executorUser: String
def appendStdout(log: String): Unit = if (executor.isInternalExecute) {
logger.info(log)
} else {
var taskLog = log
if (
ComputationExecutorConf.ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_ENABLED.getValue &&
log.length > ComputationExecutorConf.ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_LENGTH.getValue
) {
taskLog =
s"${log.substring(0, ComputationExecutorConf.ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_LENGTH.getValue)}..."
}
val listenerBus = getEngineSyncListenerBus
getJobId.foreach(jId => listenerBus.postToAll(TaskLogUpdateEvent(jId, log)))
getJobId.foreach(jId => listenerBus.postToAll(TaskLogUpdateEvent(jId, taskLog)))
}

override def close(): Unit = {
Expand Down

0 comments on commit 5c4e779

Please sign in to comment.