Skip to content

How to run configurations with Multirun

Ruslan Khmelyuk edited this page Jul 20, 2013 · 6 revisions

Multirun with IDEA can be a powerful tool to run multirun jobs. This page gives some description of use cases that can be created using Multirun and build-in IDEA feature called "Before launch tasks".

You can add before launch tasks for any configuration using Edit Run Configuration form (Run -> Edit Configurations... -> choose whatever your configuration is).

In the run configuration edit form you can find a "Before launch" section on bottom of the form. You can add Run Another Configuration, that would be run before the Run configuration you're editing.

NOTE: For PyCharm, PHPStorm, WebStorm and other IDEA-based IDEs, there might be no option 'Run Another Configuration' by default. Installing Multirun of version 0.7 or later should fix this problem.

There are a few use cases you can implement using Multirun and Before launch tasks. Let us have tasks A, B, C and D...

1. Run task A and then task B sequentially

If you need to run task A, and then task B after task A is done, this can be done only using Before launch task: just edit configuration B and add A as before launch task using Run Another Configuration option.

2. Run task A, then task B, then task C

Once again, this can be done with only Before Launch tasks. Just edit run configuration for C, and add A and B as before launch tasks using Run Another Configuration option.

3. Run tasks A, B before task C

If you need to start tasks A and B in the same moment and after they are done start the task C, this can be done in next simple way:

  1. create multirun configuration AB with tasks A and B
  2. edit configuration C and add configuration AB as before launch task

4. Run tasks A, B before tasks C and D

This is the case when you want to run tasks A and B in parallel, and after they are done start and run tasks C and D in parallel:

  1. create multirun configuration AB with tasks A and B
  2. create multirun configuration CD with tasks C and D
  3. add configuration AB as before launch task for configuration CD