<#4384 [BUG] FAIL_AFTER_EXECUTABLE_NODES_COMPLETE ...
# flyte-github
a
#4384 [BUG] FAIL_AFTER_EXECUTABLE_NODES_COMPLETE tries to execute nodes which should never start when using dynamic Issue created by fellhorn Describe the bug In a specific complex workflow with dynamic tasks and caching and the
FAIL_AFTER_EXECUTABLE_NODES_COMPLETE
workflow failure policy, we observed a truly peculiar bug: A node which should never be tried to execute as it depends on an already failed (dynamic) task, is not correctly skipped but can't be started and fails after 50 retries with:
Copy code
Workflow[...] failed. RuntimeExecutionError: max number of system retry attempts [51/50] exhausted. Last known status message: Failed to check Catalog for previous results: failed to read inputs when trying to query catalog: [READ_FAILED] failed to read data from dataDir [.../inputs.pb]., caused by: path:gs://.../inputs.pb: not found
from flyte/flytepropeller/pkg/controller/nodes/cache.go Line 96 in </flyteorg/flyte/commit/feeda193f285116a207342d17b173217650f3b0a|feeda19> * * * A minimal example:
Copy code
from flytekit import WorkflowFailurePolicy, dynamic, task, workflow

CACHE = "0.0.25" # Bumping cache between retries
USE_CACHE = True # Bug only occurs with active caching

@task(cache=USE_CACHE, cache_version=CACHE)
def my_task(number: int, will_fail: bool) -> int:
    if will_fail:
        raise Exception("Failure")
    return number + 1


@dynamic
def dyn_task(will_fail: bool) -> int:
    return my_task(number=42, will_fail=will_fail)


@workflow(failure_policy=WorkflowFailurePolicy.FAIL_AFTER_EXECUTABLE_NODES_COMPLETE)
def main():
    result1 = dyn_task(will_fail=False)
	# This dyn_task is never started although it should be due to the failure policy
    my_task(number=result1, will_fail=False) # <- This is stuck in `Unknown`

    result2 = dyn_task(will_fail=True)
	# This my_task should never be executed as it depends on the dyn_task above which will fail
    my_task(number=result2, will_fail=True) # <- This is stuck in `Unknown` and causes the cache check error after 50 retries
image Expected behavior
Copy code
@workflow(failure_policy=WorkflowFailurePolicy.FAIL_AFTER_EXECUTABLE_NODES_COMPLETE)
def main():
    result1 = dyn_task(will_fail=False)
	# Should be executed
    my_task(number=result1, will_fail=False)

    result2 = dyn_task(will_fail=True)
	# Should be marked as `Skipped`
    my_task(number=result2, will_fail=True)
Additional context to reproduce We debugged this with flyte
1.10.0
but we believe we have seen this already before. Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte