ruanwenjun opened a new issue #5483:
URL: https://github.com/apache/dolphinscheduler/issues/5483


   **Describe the bug**
   When I want to view the variables defined in process instance, it will throw 
an exception.
   
   **To Reproduce**
   Steps to reproduce the behavior, for example:
   1. Create a process definition
   2. Add localparams
   3. Execute the process definition
   4. View params in process instance
   
   
   **Screenshots**
   
![image](https://user-images.githubusercontent.com/22415594/118438653-4b46e400-b717-11eb-94d4-5e187a377d51.png)
   
   
   **Which version of Dolphin Scheduler:**
    -[dev]
   
   **Additional context**
   This issue caused by deserialize the taskParams in TaskDefinitionLog.
   
   
https://github.com/apache/dolphinscheduler/blob/68301db6b914ff4002bfbc531c6810864d8e47c2/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java#L664-L666
   
   For example, there exist list in the json attribute, so it cannot be 
deserialized as string.
   ```json
   {
       "resourceList":[
   
       ],
       "localParams":[
           {
               "prop":"BATCH_TIME",
               "direct":"IN",
               "type":"VARCHAR",
               "value":"20210517131849"
           }
       ],
       "rawScript":"echo "${BATCH_TIME}"",
       "conditionResult":"{"successNode":[""],"failedNode":[""]}",
       "dependence":"{}"
   }
   
   ```
   And there are multiple places use different way to deserialize the` 
taskParams`. 
   
https://github.com/apache/dolphinscheduler/blob/68301db6b914ff4002bfbc531c6810864d8e47c2/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java#L1611
   
   I think it is better to use the same way to do this transform, otherwise, 
once we make changes, we need to change many places.
   
   And the `taskParams` is transported by front-end and stored in database as a 
JSON string. We use Map to represent this field in backend, I think it is 
better to define a specific class to express the `taskParams`, this maybe 
helpful for deserialize and code maintain.
   


-- 
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.

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


Reply via email to