https://flyte.org logo
#ask-the-community
Title
# ask-the-community
a

Andrés Gómez Ferrer

03/30/2023, 1:42 PM
Does anyone know the right way to raise a
ContainerError
inside a task using flytekit python? https://docs.flyte.org/projects/flyteidl/en/latest/protos/docs/core/core.html#ref-flyteidl-core-containererror For example, if I want to raise/return
NON_RECOVERABLE
or
RECOVERABLE
depends of the task logic
k

Ketan (kumare3)

03/30/2023, 1:46 PM
https://docs.flyte.org/projects/flytekit/en/latest/design/authoring.html Cc @Samhita Alla / @David Espejo (he/him) this page is not rendering well
a

Andrés Gómez Ferrer

03/30/2023, 2:03 PM
so if it is the case:
Copy code
@task
def t1(a: int) -> op:
    raise FlyteRecoverableException("error")
    return op(a + 2, "world")
This is a recoverable task and flyte should retry it, right?
k

Ketan (kumare3)

03/30/2023, 2:06 PM
Are you seeing it otherwise - suspense 😬
a

Andrés Gómez Ferrer

03/30/2023, 2:18 PM
I'm seeing this:
Copy code
Traceback (most recent call last):

      File "/usr/src/app/.venv/lib/python3.8/site-packages/flytekit/exceptions/scopes.py", line 203, in user_entry_point
        return wrapped(*args, **kwargs)
      File "/usr/src/app/andresg_wf_testing/test.py", line 14, in t1
        raise FlyteRecoverableException("error")

Message:

    error

User error.
but the task only tried to do one attempt 😕
k

Ketan (kumare3)

03/30/2023, 3:55 PM
Do you have retries set
a

Andrés Gómez Ferrer

03/30/2023, 4:03 PM
yeah! you are right 🙈 sorry
and thank you 🙂
k

Ketan (kumare3)

03/30/2023, 4:48 PM
anytime
s

Samhita Alla

03/31/2023, 9:34 AM
@Ketan (kumare3), created a PR to fix the authoring structure page. https://github.com/flyteorg/flytekit/pull/1572
k

Ketan (kumare3)

03/31/2023, 3:08 PM
Can you improve the description- mark things and then +1
s

Samhita Alla

03/31/2023, 3:29 PM
I haven't understood, Ketan. What is it that I should change?
72 Views