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

Decrease_running_resources to zero not working as expected #2576

Closed
tiamot opened this issue Nov 9, 2018 · 4 comments
Closed

Decrease_running_resources to zero not working as expected #2576

tiamot opened this issue Nov 9, 2018 · 4 comments

Comments

@tiamot
Copy link

tiamot commented Nov 9, 2018

I attempted to do the following with the expectation that after 10 seconds the first task would release the resource and allow the second task to run in parallel:

import luigi


class Y(luigi.Task):
    wait = luigi.IntParameter(default=10)
    n = luigi.IntParameter()

    resources = ({'A': 1})

    def output(self):
        return luigi.LocalTarget('out{}.txt'.format(self.n))

    def run(self):
        sleep(self.wait)
        self.decrease_running_resources({'A': 0})
        sleep(self.wait)
        f = self.output().open('w')
        f.close()


class Z(luigi.WrapperTask):
    tasks = [Y(n=x) for x in range(20)]

    def requires(self):
        yield self.tasks
$ luigid
$ luigi --module x Z --workers 20
@dlstadther
Copy link
Collaborator

I have zero experience with luigi resources. I could look into this more, but the time is not available at this moment.

Looks like @riga and @daveFNbuck have contributed to this feature. Maybe they can help!

@Tarrasch
Copy link
Contributor

Tarrasch commented Nov 9, 2018

"Decrease" naturally acts as "minus". I think you made this oversight. You probably wanted

self.decrease_running_resources({'A': 1})

Happy plumbing! :)

@Tarrasch Tarrasch closed this as completed Nov 9, 2018
@tiamot
Copy link
Author

tiamot commented Nov 13, 2018

Anyway I could help by updating the documentation to make it more clear?

@dlstadther
Copy link
Collaborator

In general, PRs to improve Luigi documentation clarity are invited :) @tiamot

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

No branches or pull requests

3 participants