# Threading CLI commands

**URL:** <https://discourse.slicer.org/t/threading-cli-commands/1576>\
**Category:** Development\
**Tags:** python, cli\
**Created:** [December 1, 2017, 4:40pm UTC](https://discourse.slicer.org/t/threading-cli-commands/1576 "2017-12-01T16:40:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![purav70](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@purav70](https://discourse.slicer.org/u/purav70)\
**Post date:** [December 1, 2017, 4:40pm UTC](https://discourse.slicer.org/t/threading-cli-commands/1576/1 "2017-12-01T16:40:02Z")

</div>

Hi there,

I was wondering if the method slicer.cli.run() acted as a thread, thereby running the command asynchronously, versus the method slicer.cli.runSync().

I need to call on a cli run command several times, and because the dependencies of each command are independent of each other, would using slicer.cli.run parallelize their execution?

Thanks,

Purav

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [December 1, 2017, 4:55pm UTC](https://discourse.slicer.org/t/threading-cli-commands/1576/2 "2017-12-01T16:55:11Z")

</div>

Yes, they can be run in parallel and you can monitor progress and end events. But also note that a lot of the ITK based CLI implementations already do image-level threading so you may overload your CPU by running them in parallel. Use top / Task Manager / Activity Monitor as needed.

This test should give you an idea:

> <https://github.com/Slicer/Slicer/blob/master/Applications/SlicerApp/Testing/Python/CLIEventTest.py>
