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

Feature Request: gokart.build dump to tmpfile #244

Open
vaaaaanquish opened this issue Aug 29, 2021 · 4 comments
Open

Feature Request: gokart.build dump to tmpfile #244

vaaaaanquish opened this issue Aug 29, 2021 · 4 comments
Labels

Comments

@vaaaaanquish
Copy link
Contributor

I would like to see a function that can be used for tests where you don't want to leave a pkl.

now

df = gokart.build(Foo())    # dump pkl ./resource/...

feature image

df = gokart.build(Foo(), not_dump=True)    # to tmpfile and rm

However, whether this should be implemented in build is a matter of debate.

@mski-iksm
Copy link
Contributor

@vaaaaanquish
I agree implementing this feature.

However, I thought it would be nice to have this option in TaskOnKart, since there are cases where you don't want to keep a dump file. (e.g. Task is very simple and takes short time to run, but the dump data size is very large that it pressurize the storage cost.)

@vaaaaanquish
Copy link
Contributor Author

vaaaaanquish commented Sep 1, 2021

@mski-iksm All right.

I think when implemented in TaskOnKart, going to be complicated to deal with intermediate dependent tasks.. 🤔
My idea is dump to tmpfile. This is probably too easy.

Do you have any other good ideas?

@Hi-king
Copy link
Member

Hi-king commented Sep 2, 2021

I think we only need to inject workspace_directory of final task.
As following

class TaskA(gokart.TaskOnKart):
    def run(self):
        print(self.output().path())
        self.dump("")

class TaskB(TaskA):
    def requires(self):
        return TaskA()

with tempfile.TemporaryDirectory() as d:
    print(d)
    gokart.build(TaskB(workspace_directory=d), verbose=True)

@hirosassa
Copy link
Collaborator

agree with @Hi-king 's idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants