cubed
cubed copied to clipboard
Flow control for worker task submission
For very large computations when the number of tasks for an array is much greater than the number of workers, it may be desirable to have more control over task submission in the client, so a large number of submissions doesn't overwhelm the client (memory) or the backend service.
Lithops' map function, for example, will materialize all the inputs before submission. So in this case it might be appropriate to batch the submissions. Note that Lithops' wait function can wait on futures from different map submissions, so it should be possible to implement flow control this way.
For Modal, which has an async interface, it may be possible to just stream the inputs as they are produced on the client - it would need some experimentation.
I ran a small experiment with Modal and demonstrated that results are returned to the client before all the input is consumed.