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

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar feature requirement.
   
   
   ### Description
   
   Currently, the only way we can enable/disable a specific task via a 
condition on global params is using a switch. However, a switch requires a 
default branch. My current workaround is having a dummy task as a default, but 
this makes the DAG unnecessary cluttered. It would be nice if either the 
default branch for switch was optional, or some other kind of task could 
support this use case.
   
   
   ### Use case
   
   Let’s say I have a cleanup_task, and I want it to execute only if the global 
param cleanup is true. Currently, I do the following:
   Switch(
        name=“cleanup_task_switch”,
        condition=SwitchCondition(
               condition=“${cleanup} == ‘true’”,
               Task=cleanup_task,
       ),
       Default(
           task=dummy_task
       )
   )
   
   I’m looking for a way to eliminate the need for a dummy_task so that I can 
simply have something like this:
   Switch(
        name=“cleanup_task_switch”,
        condition=SwitchCondition(
               condition=“${cleanup} == ‘true’”,
               Task=cleanup_task,
       ),
   )
    (as evident from my example, I'm generating my DAGs using python).
   
   ### Related issues
   
   A related discussion: 
https://github.com/apache/dolphinscheduler/discussions/12426
   
   ### Are you willing to submit a PR?
   
   - [X] 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