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

Easier conditional none check #5676

Open
2 tasks done
wild-endeavor opened this issue Aug 20, 2024 · 1 comment
Open
2 tasks done

Easier conditional none check #5676

wild-endeavor opened this issue Aug 20, 2024 · 1 comment
Labels
conditionals Used to group issues related to the use of Conditionals in workflows housekeeping Issues that help maintain flyte and keep it tech-debt free

Comments

@wild-endeavor
Copy link
Contributor

wild-endeavor commented Aug 20, 2024

Describe the issue

This sample code should work

def test_condition_is_none2():
    @dataclass
    class MyDataClass(DataClassJSONMixin):
        a: int
        b: str

    @task
    def maybe_str(a: int) -> typing.Optional[MyDataClass]:
        if a > 5:
            return MyDataClass(a=a, b="hello")
        return None

    @task
    def failed() -> int:
        return 10

    @task
    def success() -> int:
        return 20

    @workflow
    def decompose_unary() -> int:
        result = maybe_str(a=6)
        return conditional("test").if_(result.is_none()).then(success()).else_().then(failed())

    xx = decompose_unary()
    print(xx)

Currently it is producing an error

ValueError: Only primitive values can be used in comparison

While it makes sense that propeller in the back can only check primitives, I think we can make an exception for optional/none.

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@wild-endeavor wild-endeavor added the housekeeping Issues that help maintain flyte and keep it tech-debt free label Aug 20, 2024
@wild-endeavor wild-endeavor changed the title [Housekeeping] dsaf [flytekit] Conditional none check Aug 20, 2024
Copy link

runllm bot commented Aug 20, 2024

To create a housekeeping issue in Flyte, you can use the housekeeping issue template. Here is a sample issue based on your input:

name: Housekeeping
description: Maintenance and cleanup tasks that need to be performed may include tech debt, library upgrades, CI/CD improvements, etc.
title: "[Housekeeping] dsaf"
labels: housekeeping
body:
  - type: textarea
    id: issue-description
    validations:
      required: true
    attributes:
      label: "Describe the issue"
      description: "A clear and concise description of what the housekeeping item is."
      placeholder: "Clean up [...] OR upgrade [...] library to pull in the latest changes, etc."
      value: "fdsa"
  - type: textarea
    id: consequences
    validations:
      required: true
    attributes:
      label: "What if we do not do this?"
      description: "Short description of potential consequences"
      placeholder: "Higher propensity for errors, uncleanliness, lack of polish, [...]"
      value: "fdsa"
  - type: textarea
    id: related-component
    validations:
      required: false
    attributes:
      label: "Related component(s)"
      description: "Either specific or all"
      placeholder: "flyteidl, [...]"
      value: "fdfsa"
  - type: checkboxes
    id: no-duplicate-issues
    attributes:
     label: "Are you sure this issue hasn't been raised already?"
     options:
        - label: "Yes"
          required: true
          value: true
  - type: checkboxes
    id: read-code-of-conduct
    attributes:
      label: "Have you read the Code of Conduct?"
      description: "[Code of Conduct](https://github.com/flyteorg/flyte/blob/master/CODE_OF_CONDUCT.md)"
      options:
        - label: "Yes"
          required: true
          value: true

Would you like more details on how to submit this issue on GitHub?

Sources:


This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.

Mention @RunLLM to ask follow-up questions. See runllm.com for more!

@wild-endeavor wild-endeavor changed the title [flytekit] Conditional none check Easier conditional none check Aug 20, 2024
@eapolinario eapolinario added the conditionals Used to group issues related to the use of Conditionals in workflows label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conditionals Used to group issues related to the use of Conditionals in workflows housekeeping Issues that help maintain flyte and keep it tech-debt free
Projects
None yet
Development

No branches or pull requests

2 participants