I’m developing a package which submits some jobs over the network. My main
do_job(...) function uses
@async and sends data over without blocking so I can submit multiple jobs and potentially handle them in parallel. However, having async API as a default might be overly complex. Often users will effectively wrap it with
I am new to the Julia community and it seems there should be an idiomatic way to have such an API. Here are the options I came up with:
- keyword parameter:
do_job(...; async=False) = async ? do_job(...) : fetch(do_job(...))
- two functions:
do_jobsynchronous and let the user do
@async(do_job(...))if they need to do jobs in parallel.
- …Any suggestions?