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

[BUG] Fail to walk through a FlyteDirectory through os.listdir #6148

Open
2 tasks done
JiangJiaWei1103 opened this issue Jan 8, 2025 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers

Comments

@JiangJiaWei1103
Copy link
Contributor

Describe the bug

Currently, FlyteDirectory doesn't support os.listdir with a remote S3 path (fortunately, a local path works!). The error is shown as follows:
Screenshot 2025-01-08 at 9 10 58 PM

Though FlyteDirectory provides listdir method itself, I just think os.listdir could provide a better UX.

Expected behavior

A FlyteDirectory with a remote S3 path can be walked through by os.listdir, as commented here

Additional context to reproduce

Create a demo dir on minio and add a text file first. Then, run the following script:

import os
from flytekit import task 
from flytekit.types.directory import FlyteDirectory 


S3_DIR = "s3://my-s3-bucket/demo


@task
def create_fd() -> FlyteDirectory:
    fd = FlyteDirectory(path=S3_DIR)

    entities = os.listdir(fd) 
    for e in entities:
        # Suppose there's no subdir
        with open(os.path.join(S3_DIR, e), "r") as f:
            print(f.read())

    return fd


if __name__ == "__main__":
    fd = create_fd()
    print(fd)

Screenshots

No response

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

  • Yes

Have you read the Code of Conduct?

  • Yes
@JiangJiaWei1103 JiangJiaWei1103 added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers
Projects
Status: Backlog
Development

No branches or pull requests

1 participant