-
Notifications
You must be signed in to change notification settings - Fork 11
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/Enhancement: Ability to limit the number of tasks that can run concurrently in the 'local' batch_system (or per batch system) #170
Comments
Hi Marcel, Cheers, Felix |
Hi Felix, |
I think a Independent of this, the tasks you were referring to are running locally, so the config file should be used correctly. Also keep in mind, that a resource is only considered, if the task defines it and that you can change this at runtime based on luigi parameters or other information such as the host name, etc.. I would say, you just have to give it a try and see what works for you. Cheers, Felix |
Thanks @FelixMetzner for explaining how to achieve this with luigi. I also never used resources before, but googling a bit shows some examples how to use them, e.g. in the Luigi Patterns documentation. Taken inspiration from them, I think using a property function for the resources could probably make for a dynamic solution which changes the max jobs automatically based on the batch-system of the task: class A(b2luigi.Task):
...
@property
def resources(self):
# If the batch-system is local, use up one local_task resource,
# otherwise use up one batch_task resource.
if b2luigi.get_setting("batch_system", task=self) == "local":
return {"local_tasks": 1}
return {"batch_tasks": 1} Then also all tasks inheriting from A will have this dynamic property. Not sure whether the about code works, as I said I never tested it, but if it works maybe it would be nice to document this somewhere, as it's a useful feature. I'm myself guilty of once accidentally starting 800 local tasks, because I wanted to process on htcondor and increased the workers after a test-run but forgot to change the batch-system. I admit it would be comfortable to have somewhere a setting which sets this for all batch-systems by default without having to give resource properties to each task, possibly with a sensible default maximum number of local tasks. But I don't want to add much code and complexity for that when there is something users can do themselves. |
Thank you both, I have now tested the resources feature and this works nicely for what I need. Perhaps this could be added to the documentation on setting the 'local' batch system. |
Hi,
I often find myself running event generation and ntuple production tasks in the hundreds to thousands on lsf at kekcc followed by a few brief tasks which must be run locally rather than on the batch system due to memory issues. For these tasks I specify batch_system='local'.
In order for the tasks that are processed on the batch system to be submitted I set workers=1000. Once it comes time however for the local jobs to run this means that b2luigi tries to start lots of tasks simultaneously and runs into many Resource Unavailable errors. I would therefore like to add a feature to specify a separate number of workers for the 'local' batch_system. If you agree this would be useful I can start to work on this.
The text was updated successfully, but these errors were encountered: