Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a parallel node in a workflow contains if/else nodes, if the node after the parallel node does not wait for all parallel nodes to complete #11756

Open
5 tasks done
chingzio opened this issue Dec 17, 2024 · 3 comments
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.

Comments

@chingzio
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.0

Cloud or Self Hosted

Cloud

Steps to reproduce

1734438299730

✔️ Expected Behavior

After parallelism, the node waits for all nodes to complete the execution and resumes the operation

❌ Actual Behavior

A parallel post-node executes immediately after the first parallel node is executed

@dosubot dosubot bot added 🌊 feat:workflow Workflow related stuff. 🐞 bug Something isn't working labels Dec 17, 2024
Copy link

dosubot bot commented Dec 17, 2024

Hey @chingzio! 👋 I'm here to help you with bug reports, answer questions, and even assist you in becoming a contributor. Let's squash those bugs together!

I couldn't find specific information about the behavior of if/else nodes within a parallel node in Dify's workflow. However, I found a similar unsolved discussion regarding issues with parallel execution in workflows. You might find it helpful to check out this discussion, which addresses a major issue with parallel execution in version 0.8.0 [1].

Additionally, Dify's workflow engine typically uses a queue to ensure that all parallel branches complete before proceeding to the next node. This mechanism involves waiting for all branches to succeed before moving on, as described in the _run_parallel_branches method [2]. If your workflow is not behaving as expected, it might be worth checking if there are any configuration settings or updates that could affect this behavior.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@chingzio
Copy link
Author

my yaml

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: test_if_else
  use_icon_as_answer_icon: false
kind: app
version: 0.1.4
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1734339163183-source-1734436159127-target
      source: '1734339163183'
      sourceHandle: source
      target: '1734436159127'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: code
      id: 1734339163183-source-1734436167750-target
      source: '1734339163183'
      sourceHandle: source
      target: '1734436167750'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: code
      id: 1734339163183-source-1734436179342-target
      source: '1734339163183'
      sourceHandle: source
      target: '1734436179342'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: code
      id: 1734436167750-source-1734436187534-target
      source: '1734436167750'
      sourceHandle: source
      target: '1734436187534'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: code
      id: 1734436179342-source-1734436187534-target
      source: '1734436179342'
      sourceHandle: source
      target: '1734436187534'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: variable-aggregator
      id: 1734436187534-source-1734436200878-target
      source: '1734436187534'
      sourceHandle: source
      target: '1734436200878'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1734436159127-true-1734436217190-target
      source: '1734436159127'
      sourceHandle: 'true'
      target: '1734436217190'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: variable-aggregator
      id: 1734436217190-source-1734436200878-target
      source: '1734436217190'
      sourceHandle: source
      target: '1734436200878'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: variable-aggregator
        targetType: end
      id: 1734436200878-source-1734436245606-target
      source: '1734436200878'
      sourceHandle: source
      target: '1734436245606'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: arg
          max_length: 48
          options: []
          required: true
          type: text-input
          variable: arg
      height: 90
      id: '1734339163183'
      position:
        x: 30
        y: 269
      positionAbsolute:
        x: 30
        y: 269
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: 09823c40-b824-4931-bb9a-7d733e1cade6
            value: aaa
            varType: string
            variable_selector:
            - '1734339163183'
            - arg
          id: 'true'
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 126
      id: '1734436159127'
      position:
        x: 334
        y: 457
      positionAbsolute:
        x: 334
        y: 457
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str, arg2: str) -> dict:\n    return {\n        \"\
          result\": arg1 + arg2,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行
        type: code
        variables:
        - value_selector:
          - '1734339163183'
          - arg
          variable: arg1
        - value_selector:
          - '1734339163183'
          - arg
          variable: arg2
      height: 54
      id: '1734436167750'
      position:
        x: 334
        y: 269
      positionAbsolute:
        x: 334
        y: 269
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str, arg2: str) -> dict:\n    return {\n        \"\
          result\": arg1 + arg2,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 2
        type: code
        variables:
        - value_selector:
          - '1734339163183'
          - arg
          variable: arg1
        - value_selector:
          - '1734339163183'
          - arg
          variable: arg2
      height: 54
      id: '1734436179342'
      position:
        x: 334
        y: 363
      positionAbsolute:
        x: 334
        y: 363
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str, arg2: str) -> dict:\n    return {\n        \"\
          result\": arg1 + arg2,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 3
        type: code
        variables:
        - value_selector:
          - '1734436167750'
          - result
          variable: arg1
        - value_selector:
          - '1734436179342'
          - result
          variable: arg2
      height: 54
      id: '1734436187534'
      position:
        x: 638
        y: 269
      positionAbsolute:
        x: 638
        y: 269
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        output_type: string
        selected: false
        title: 变量聚合器
        type: variable-aggregator
        variables:
        - - '1734436187534'
          - result
        - - '1734436217190'
          - result
      height: 130
      id: '1734436200878'
      position:
        x: 942
        y: 269
      positionAbsolute:
        x: 942
        y: 269
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str, arg2: str) -> dict:\n    return {\n        \"\
          result\": arg1 + arg2,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 4
        type: code
        variables:
        - value_selector:
          - '1734339163183'
          - arg
          variable: arg1
        - value_selector:
          - '1734339163183'
          - arg
          variable: arg2
      height: 54
      id: '1734436217190'
      position:
        x: 638
        y: 481
      positionAbsolute:
        x: 638
        y: 481
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1734436200878'
          - output
          variable: output
        selected: false
        title: 结束
        type: end
      height: 90
      id: '1734436245606'
      position:
        x: 1246
        y: 269
      positionAbsolute:
        x: 1246
        y: 269
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: 117
      y: 230.30000000000004
      zoom: 0.7

@chiguaaa
Copy link

I have the same problem. Did you manage to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.
Projects
None yet
Development

No branches or pull requests

2 participants