dolphinscheduler-sdk-python icon indicating copy to clipboard operation
dolphinscheduler-sdk-python copied to clipboard

[impv] Auto check and add output local_params if we define the special grammar in the task definition

Open jieguangzhou opened this issue 2 years ago • 4 comments

For example If we define the shell task, and the command like this

task = Shell(name="example", command="${setValue(a=1)}")

Then we can auto add the output local_params {"prop": "a", "direct": "OUT", "type": "VARCHAR", "value": ""}

The Python, SQL, Procedure also can do this

jieguangzhou avatar Dec 21 '22 07:12 jieguangzhou

@zhongjiajie Sir please assign this issue to me and brief me about the issue.

HarshitNagpal29 avatar Jan 17 '24 06:01 HarshitNagpal29

currently, we have to explicitly declare the parameters that need to be set output, such as

task = Shell(name="example", command="${setValue(a=1)}", output_params={
            "a": "",
        })

and this issue want to remove the param output_params in Shell,

task = Shell(name="example", command="${setValue(a=1)}")

and we set in in pydolphinscheduler

zhongjiajie avatar Jan 17 '24 07:01 zhongjiajie

@zhongjiajie Sir, sorry for the delayed response. My internal University exams were going on that's why I was not able to respond, sir I looked into this isssue and I am finding it a bit difficult due to certain reasons:

  1. The current Shell class has no explicit code for defining or managing output parameters.
  2. Integration of setValue internally with task classes is kind of very confusing for me. Can you please provide me with some hints on how to approach this problem ,I am feeling very overwhelmed.

HarshitNagpal29 avatar Jan 25 '24 19:01 HarshitNagpal29

hi, @HarshitNagpal29 do not worry about that, handle your exams it more important thing. and

  1. We have this parameter in our base class, and shell task inherit the base class, which you can see in https://github.com/apache/dolphinscheduler-sdk-python/blob/a7026dab2fb8443e66b72160b5a54977c3d07211/src/pydolphinscheduler/core/task.py#L169
  2. the setValue is the keyword for dolphinschdudler,we use it to set output value in dolphinscheduler web ui, which you can see in https://dolphinscheduler.apache.org/en-us/docs/3.2.0/guide/parameter/context. As you can see, In web ui we have to do both setValue in the content of task definition, and add output parameter in customer parameter and set it as out. but I think we can just use setValue syntax in python sdk, then detect and set param by python sdk itself

zhongjiajie avatar Jan 30 '24 01:01 zhongjiajie