flyte icon indicating copy to clipboard operation
flyte copied to clipboard

Offloading of objects during registration is a difficult to debug trap for inexperienced users

Open fg91 opened this issue 9 months ago β€’ 5 comments

Discussed in https://github.com/flyteorg/flyte/discussions/4743

Originally posted by fg91 January 18, 2024 Let us consider an example where 1) the type engine transports an object by offloading it to blob storage (in this case as a pickle file) and 2) where this object is instantiated not in a task but when calling a task in a workflow:

from flytekit import task, workflow


class Config:
    """Something that is transported by the Flyte type engine via pickle."""
    def __init__(self, a) -> None:
        self.a = a


@task
def print_config(config: Config) -> None:
    print(config)


@workflow
def wf():
    print_config(config=Config(a=5))

This workflow fails with:

      File ".../flytekit/core/base_task.py", line 626, in dispatch_execute
        raise type(exc)(msg) from exc

Message:

    Failed to convert inputs of task 'wf.print_config':
  [Errno 2] No such file or directory: '/var/folders/vz/l684gsw57pndcbm_909n9jp40000gn/T/flyte-e45vhbku/raw/91b6f84917aa22176a7ba5a4f4e71fd5/74a1306209f894ebf0fc720fde719b3b'

SYSTEM ERROR! Contact platform administrators.

The reason is that during registration, pyflyte does not realize that the object needs to be uploaded to blob storage. The user would have to proactively configure the raw data prefix.

I would argue that this example is very difficult to understand and debug for users that don't have a clear understanding of Flyte's data model and too "simple" to let users fall into this trap.

As a user I would want flytekit to 1) realize that during registration, files need to be offloaded to blob storage and 2) the backend to specify a default raw data prefix during registration unless I configured it explicitly in my flyte config file.


How could this be fixed?

In the FileAccessProvider, we need to prevent that put_raw_data stores offloaded objects locally during registration.

  • Is there a way to determine from "the flyte context that we are in registration mode"? Then we could at least catch this error and tell users to configure the raw data prefix.
  • Could pyflyte request the raw_data_prefix from flyteadmin if the user didn't set it explicitly and "make the file access provider aware of it"?

fg91 avatar Feb 27 '25 17:02 fg91

I experience something similar, where I reference a util function via import that doesn’t get injected into the task when executing. My fix was to use fast_register_workflow instead of register_workflow when using FlyteRemote

cjkeilig avatar Apr 17 '25 00:04 cjkeilig

"Hello πŸ‘‹, this issue has been inactive for over 90 days. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! πŸ™"

github-actions[bot] avatar Jul 17 '25 00:07 github-actions[bot]

I agree we got rid of it in v2

kumare3 avatar Jul 17 '25 01:07 kumare3

"Hello πŸ‘‹, this issue has been inactive for over 90 days. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! πŸ™"

github-actions[bot] avatar Oct 17 '25 00:10 github-actions[bot]

Completely agreed we got rid of it in v2.0

kumare3 avatar Oct 17 '25 01:10 kumare3