flyteorg / flyte

Scalable and flexible workflow orchestration platform that seamlessly unifies data, ML and analytics stacks.
https://flyte.org
Apache License 2.0
5.77k stars 658 forks source link

[BUG] @task decorator function that returns -> ValueError | FlyteFile[Any] causes a silent failure of the FlyteFile job #4301

Open ssriram1978 opened 1 year ago

ssriram1978 commented 1 year ago

Describe the bug

Let's take this task decorator as an example:

@task
def create_global_model_artifact(
    B_variants: Dict, name: str
) -> ValueError | FlyteFile[Any]:
    klass = GLOBAL_MODELS.get(name, None)

    if klass is None:
        return ValueError(
            f"No model named {name} exists. Valid options: {list(MODELS.keys())} "
        )

    model = klass(B_variants=B_variants)

    output = package_tfmodel_for_sagemaker(model, signatures={name: model.__call__})

    return FlyteFile(path=output)

Here this task is failing silently with WARNING:

2023-10-25 15:27:16,950 [INFO] botocore.credentials - Found credentials from IAM Role: dcp-cd-recs-databricks-instance-profile
{"asctime": "2023-10-25 15:27:17,115", "name": "flytekit", "levelname": "WARNING", "message": "Unsupported Type ValueError | flytekit.types.file.file.FlyteFile.__class_getitem__.<locals>._SpecificFormatClass found, Flyte will default to use PickleFile as the transport. Pickle can only be used to send objects between the exact same version of Python, and we strongly recommend to use python type that flyte support."}

Expected behavior

The task should not fail and the Flyte job should succeed.

Additional context to reproduce

No response

Screenshots

No response

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

Have you read the Code of Conduct?

welcome[bot] commented 1 year ago

Thank you for opening your first issue here! šŸ› 

github-actions[bot] commented 3 months ago

Hello šŸ‘‹, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable. Thank you for your contribution and understanding! šŸ™