Overview
Last updated
Last updated
burla.remote_parallel_map
Run any python function on many remote computers at the same time. See the
remote_parallel_map
requires two arguments:
Then remote_parallel_map
can be called like:
When run, remote_parallel_map
will call my_function
, on every object in my_inputs
, at the same time, each on a separate CPU in the cloud (the max #CPUs depends on your cluster settings).
In under 1 second, the three function calls are made, all at the same time:
my_function(1)
, my_function(2)
, my_function(3)
Stdout produced on the remote machines is streamed back to the client (your machine). The return values of each function are also collected and sent back to the client. The following displays in the client's terminal:
In the above example, each function call would have been made inside a separate container, each with their own isolated filesystem.
The func_cpu
and func_ram
arguments can be used to assign more resources to each individual function call, up to max amount your machine type supports.
background
makes remote_parallel_map
exit after having uploaded the function and inputs. After which the job will continue to run independantly on the cluster in the background.
spinner
can be used to turn off the spinner, which also displays status messages from the cluster, like the state of the current job.
generator
makes remote_parallel_map
return a python generator
object instead of a list
containing return values. This generator yields return values as they are produced instead of all at once.
max_parallelism
can be used to limit the number of function calls running at the same time.
By default, the cluster will execute as many parallel functions as possible given available resources.
This can be useful to avoid overloading external systems like databases or other web services.
remote_parallel_map
has a few optional arguments, see for the full API-doc.
Questions? , or email jake@burla.dev. We're always happy to talk!