How to set parallelism conditionally in circleci config.yml?

I have an e2e job setup in circleci. I would like to set the parallelism property to either 1 or 4 depending on a specific parameter. But I am not able to understand how would I do this in terms of syntax. I tried this but does not work:

 e2e:
     when:
         condition: << parameters.test_parameter >>
                  parallelism: 4
     unless:
         condition: << parameters.test_parameter >>
                  parallelism: 1

The above does not seem to be right. The build fails showing syntax error at parallelism level saying mapping values are not allowed. Any clue of how to achieve this in circleci? TIA

2 Likes

Bumping this - would be very useful to have this dynamically set.