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

   ### 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
   
   When a Dependent task is configured with **Dependent Type** set to 
**Dependent On Task** and **Task Name** set to `ALL`, the task fails while 
processing the dependency result:
   
   ```text
   java.lang.IllegalArgumentException: Invalid key format
       at 
org.apache.dolphinscheduler.plugin.task.api.model.DependentItem.fromKey(DependentItem.java:48)
       at 
org.apache.dolphinscheduler.server.master.engine.executor.plugin.dependent.DependentTaskTracker.isAllDependentTaskFinished(DependentTaskTracker.java:245)
   ```
   
   The generated task parameters contain `depTaskCode: -1`:
   
   ```json
   {
     "dependentType": "DEPENDENT_ON_TASK",
     "projectCode": 1001,
     "definitionCode": 2001,
     "depTaskCode": -1,
     "cycle": "day",
     "dateValue": "today",
     "parameterPassing": false
   }
   ```
   
   In the official `dev` branch, the UI assigns `-1` to the `ALL` option:
   
   ```typescript
   taskList.unshift({
     value: -1,
     label: 'ALL',
     filterLabel: 'ALL'
   })
   ```
   
   `DependentItem#getKey()` then produces a key similar to:
   
   ```text
   2001--1-day-today
   ```
   
   `DependentItem#fromKey()` splits the key using `key.split("-")` and requires 
exactly four parts. A negative task code introduces an additional hyphen, so 
the key is split into five parts and `Invalid key format` is thrown.
   
   ### What you expected to happen
   
   When **Dependent Type** is **Dependent On Task** and **Task Name** is `ALL`, 
the Dependent task should check all tasks in the selected workflow and 
calculate the dependency result without throwing a key-format exception.
   
   ### How to reproduce
   
   1. Create and run a workflow that will be used as the dependency target.
   2. Add a Dependent task to another workflow.
   3. Set **Dependent Type** to **Dependent On Task**.
   4. Select the target project and workflow.
   5. Set **Task Name** to `ALL`.
   6. Set **Cycle** to `day` and the date option to `today`.
   7. Run the workflow containing the Dependent task.
   8. The Dependent task throws `Invalid key format` while processing the 
dependency result.
   
   ### Anything else
   
   The official constant defines `-1` as the special code for all tasks:
   
   ```java
   public static final long DEPENDENT_ALL_TASK_CODE = -1;
   ```
   
   The same `fromKey()` implementation is currently present in both the 
official `dev` and `3.4.2-release` branches.
   
   ### Version
   
   dev
   
   ### 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