In order to avoid blocking the terminal, remove the last line from the above code, i.e.,
# ml_client.jobs.stream(job.name) # uncomment to make it synchronous and wait until job finishes
This is documented in the following tutorial:
In this section: