WYPOWLS opened a new issue, #16830:
URL: https://github.com/apache/dolphinscheduler/issues/16830

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   
![image](https://github.com/user-attachments/assets/903178db-a30b-4031-8256-dea3f0a0d7e2)
   
![image](https://github.com/user-attachments/assets/e756385a-e178-4af1-b432-d22e2fef8f3e)
   When using shell nodes, same bash script, same output parameters, different 
results,version is 3.2.1
   
   THIS IS LOG
   [LOG-PATH]: 
/home/dolphinscheduler/dolphinscheduler/worker-server/logs/20241121/15711672610656/1/2850/9520.log,
 [HOST]:  10.244.3.1:1234
   [INFO] 2024-11-21 16:31:14.656 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:14.658 +0800 - *********************************  
Initialize task context  ***********************************
   [INFO] 2024-11-21 16:31:14.658 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:14.658 +0800 - Begin to initialize task
   [INFO] 2024-11-21 16:31:14.658 +0800 - Set task startTime: 1732177874658
   [INFO] 2024-11-21 16:31:14.658 +0800 - Set task appId: 2850_9520
   [INFO] 2024-11-21 16:31:14.658 +0800 - End initialize task {
     "taskInstanceId" : 9520,
     "taskName" : "cs",
     "firstSubmitTime" : 1732177874648,
     "startTime" : 1732177874658,
     "taskType" : "SHELL",
     "workflowInstanceHost" : "10.244.3.1:5678",
     "host" : "10.244.3.1:1234",
     "logPath" : 
"/home/dolphinscheduler/dolphinscheduler/worker-server/logs/20241121/15711672610656/1/2850/9520.log",
     "processId" : 0,
     "processDefineCode" : 15711672610656,
     "processDefineVersion" : 1,
     "processInstanceId" : 2850,
     "scheduleTime" : 1732118400000,
     "executorId" : 2,
     "cmdTypeIfComplement" : 5,
     "tenantCode" : "dolphinscheduler",
     "processDefineId" : 0,
     "projectId" : 0,
     "projectCode" : 14483060818400,
     "taskParams" : "{\"localParams\":[],\"rawScript\":\"#!/bin/bash\\r\\n# 
显示当前时间\\r\\necho \\\"当前时间为 : ${ct}\\\"\\r\\n\\r\\n# 截取时间部分\\r\\nsub_time=$(echo 
$ct | cut -c 9-14)\\r\\necho \\\"日期部分为 : ${sub_time}\\\"\\r\\n# 判断时间部分\\r\\nif 
[ \\\"$sub_time\\\" == \\\"000000\\\" ]; then\\r\\n    echo 
\\\"yes\\\"\\r\\nelse\\r\\n    echo \\\"no\\\"\\r\\nfi\",\"resourceList\":[]}",
     "environmentConfig" : "export 
DATAX_LAUNCHER=/home/dolphinscheduler/datax/bin/datax.py\nexport 
PYTHON_LAUNCHER=/home/dolphinscheduler/anaconda3/bin/python\nexport 
PATH=$PATH:$DATAX_LAUNCHER:$PYTHON_LAUNCHER",
     "prepareParamsMap" : {
       "system.task.definition.name" : {
         "prop" : "system.task.definition.name",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "cs"
       },
       "system.project.name" : {
         "prop" : "system.project.name",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : null
       },
       "pt" : {
         "prop" : "pt",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "20241120"
       },
       "system.biz.curdate" : {
         "prop" : "system.biz.curdate",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "20241121"
       },
       "system.task.instance.id" : {
         "prop" : "system.task.instance.id",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "9520"
       },
       "system.task.definition.code" : {
         "prop" : "system.task.definition.code",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "15711670763872"
       },
       "system.datetime" : {
         "prop" : "system.datetime",
         "direct" : null,
         "type" : null,
         "value" : "20241121000000"
       },
       "ct" : {
         "prop" : "ct",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "20241121000000\t"
       },
       "system.project.code" : {
         "prop" : "system.project.code",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "14483060818400"
       },
       "system.workflow.instance.id" : {
         "prop" : "system.workflow.instance.id",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "2850"
       },
       "system.biz.date" : {
         "prop" : "system.biz.date",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "20241120"
       },
       "system.workflow.definition.name" : {
         "prop" : "system.workflow.definition.name",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "cs1"
       },
       "system.workflow.definition.code" : {
         "prop" : "system.workflow.definition.code",
         "direct" : "IN",
         "type" : "VARCHAR",
         "value" : "15711672610656"
       }
     },
     "taskAppId" : "2850_9520",
     "taskTimeout" : 2147483647,
     "workerGroup" : "default",
     "delayTime" : 0,
     "currentExecutionStatus" : "SUBMITTED_SUCCESS",
     "endTime" : 0,
     "dryRun" : 0,
     "paramsMap" : {
       "system.datetime" : {
         "prop" : "system.datetime",
         "direct" : null,
         "type" : null,
         "value" : "20241121000000"
       }
     },
     "cpuQuota" : -1,
     "memoryMax" : -1,
     "testFlag" : 0,
     "logBufferEnable" : false,
     "dispatchFailTimes" : 0
   }
   [INFO] 2024-11-21 16:31:14.659 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:14.659 +0800 - *********************************  
Load task instance plugin  *********************************
   [INFO] 2024-11-21 16:31:14.659 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:14.660 +0800 - Send task status RUNNING_EXECUTION 
master: 10.244.3.1:1234
   [INFO] 2024-11-21 16:31:14.660 +0800 - TenantCode: dolphinscheduler check 
successfully
   [INFO] 2024-11-21 16:31:14.661 +0800 - WorkflowInstanceExecDir: 
/tmp/dolphinscheduler/exec/process/dolphinscheduler/14483060818400/15711672610656_1/2850/9520
 check successfully
   [INFO] 2024-11-21 16:31:14.661 +0800 - Create TaskChannel: 
org.apache.dolphinscheduler.plugin.task.shell.ShellTaskChannel successfully
   [INFO] 2024-11-21 16:31:14.661 +0800 - Download resources successfully: 
   ResourceContext(resourceItemMap={})
   [INFO] 2024-11-21 16:31:14.661 +0800 - Download upstream files: [] 
successfully
   [INFO] 2024-11-21 16:31:14.661 +0800 - Task plugin instance: SHELL create 
successfully
   [INFO] 2024-11-21 16:31:14.661 +0800 - Initialize shell task params {
     "localParams" : [ ],
     "varPool" : null,
     "rawScript" : "#!/bin/bash\r\n# 显示当前时间\r\necho \"当前时间为 : ${ct}\"\r\n\r\n# 
截取时间部分\r\nsub_time=$(echo $ct | cut -c 9-14)\r\necho \"日期部分为 : 
${sub_time}\"\r\n# 判断时间部分\r\nif [ \"$sub_time\" == \"000000\" ]; then\r\n    
echo \"yes\"\r\nelse\r\n    echo \"no\"\r\nfi",
     "resourceList" : [ ]
   }
   [INFO] 2024-11-21 16:31:14.662 +0800 - Success initialized task plugin 
instance successfully
   [INFO] 2024-11-21 16:31:14.662 +0800 - Set taskVarPool: null successfully
   [INFO] 2024-11-21 16:31:14.662 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:14.662 +0800 - *********************************  
Execute task instance  *************************************
   [INFO] 2024-11-21 16:31:14.662 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:14.662 +0800 - Final Shell file is: 
   [INFO] 2024-11-21 16:31:14.662 +0800 - ****************************** Script 
Content *****************************************************************
   [INFO] 2024-11-21 16:31:14.662 +0800 - #!/bin/bash
   BASEDIR=$(cd `dirname $0`; pwd)
   cd $BASEDIR
   export DATAX_LAUNCHER=/home/dolphinscheduler/datax/bin/datax.py
   export PYTHON_LAUNCHER=/home/dolphinscheduler/anaconda3/bin/python
   export PATH=$PATH:$DATAX_LAUNCHER:$PYTHON_LAUNCHER
   #!/bin/bash
   # 显示当前时间
   echo "当前时间为 : 20241121000000 "
   
   # 截取时间部分
   sub_time=$(echo $ct | cut -c 9-14)
   echo "日期部分为 : ${sub_time}"
   # 判断时间部分
   if [ "$sub_time" == "000000" ]; then
       echo "yes"
   else
       echo "no"
   fi
   [INFO] 2024-11-21 16:31:14.663 +0800 - ****************************** Script 
Content *****************************************************************
   [INFO] 2024-11-21 16:31:14.663 +0800 - Executing shell command : sudo -u 
dolphinscheduler -i 
/tmp/dolphinscheduler/exec/process/dolphinscheduler/14483060818400/15711672610656_1/2850/9520/2850_9520.sh
   [INFO] 2024-11-21 16:31:14.666 +0800 - process start, process id is: 87985
   [INFO] 2024-11-21 16:31:16.666 +0800 -  -> 
        当前时间为 : 20241121000000  
        日期部分为 : 
        no
   [INFO] 2024-11-21 16:31:16.668 +0800 - process has exited. execute 
path:/tmp/dolphinscheduler/exec/process/dolphinscheduler/14483060818400/15711672610656_1/2850/9520,
 processId:87985 ,exitStatusCode:0 ,processWaitForStatus:true 
,processExitValue:0
   [INFO] 2024-11-21 16:31:16.669 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:16.669 +0800 - *********************************  
Finalize task instance  ************************************
   [INFO] 2024-11-21 16:31:16.669 +0800 - 
***********************************************************************************************
   [INFO] 2024-11-21 16:31:16.669 +0800 - Upload output files: [] successfully
   [INFO] 2024-11-21 16:31:16.670 +0800 - Send task execute status: SUCCESS to 
master : 10.244.3.1:1234
   [INFO] 2024-11-21 16:31:16.670 +0800 - Remove the current task execute 
context from worker cache
   [INFO] 2024-11-21 16:31:16.670 +0800 - The current execute mode isn't 
develop mode, will clear the task execute file: 
/tmp/dolphinscheduler/exec/process/dolphinscheduler/14483060818400/15711672610656_1/2850/9520
   [INFO] 2024-11-21 16:31:16.671 +0800 - Success clear the task execute file: 
/tmp/dolphinscheduler/exec/process/dolphinscheduler/14483060818400/15711672610656_1/2850/9520
   [INFO] 2024-11-21 16:31:16.671 +0800 - FINALIZE_SESSION
   
   ### What you expected to happen
   
   Both outputs are consistent
   
   ### How to reproduce
   
   
![image](https://github.com/user-attachments/assets/c0aa790e-3dea-4366-9a2b-44f51ec6abab)
   
![image](https://github.com/user-attachments/assets/17c01624-73b0-44c8-bfac-62ca19bb9e18)
   
![image](https://github.com/user-attachments/assets/215a562c-fbf4-4dd3-912d-77860169d014)
   Create a new shell script, then only output the following text in the 
script's text box, and then use the supplemental data directly to perform the 
task
   The ct variable is ${system.datetime}
   -------------------------------------------------------------------------
   #!/bin/bash
   # 显示当前时间
   echo "当前时间为 : ${ct}"
   
   # 截取时间部分
   sub_time=$(echo $ct | cut -c 9-14)
   echo "日期部分为 : ${sub_time}"
   # 判断时间部分
   if [ "$sub_time" == "000000" ]; then
       echo "yes"
   else
       echo "no"
   fi
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.2.x
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to