Propellor properties can be made to run concurrently, using this module. This can speed up propellor, at the expense of using more CPUs and other resources.
It's up to you to make sure that properties that you make run concurrently don't implicitly depend on one-another. The worst that can happen though, is that propellor fails to ensure some of the properties, and tells you what went wrong.
Another potential problem is that output of concurrent properties could
interleave into a scrambled mess. This is mostly prevented; all messages
output by propellor are concurrency safe, including
infoMessage, etc. However, if you write a property that directly
putStrLn, you can still experience this problem.
Similarly, when properties run external commands, the command's output
can be a problem for concurrency. No need to worry;
createProcess is concurrent output safe
(it actually uses
everything else in propellor that runs external commands is built on top
of that. Of course, if you import System.Process and use it in a
property, you can bypass that and shoot yourself in the foot.
Finally, anything that directly accesses the tty can bypass these protections. That's sometimes done for eg, password prompts. A well-written property should avoid running interactive commands anyway.
- concurrently :: (IsProp p1, IsProp p2, Combines p1 p2, IsProp (CombinedType p1 p2)) => p1 -> p2 -> CombinedType p1 p2
- concurrentList :: IO Int -> Desc -> PropList -> Property HasInfo
- props :: PropList
- getNumProcessors :: IO Int
- concurrentSatisfy :: Propellor Result -> Propellor Result -> Propellor Result
Ensures two properties concurrently.
& foo `concurrently` bar
To ensure three properties concurrently, just use this combinator twice:
& foo `concurrently` bar `concurrently` baz
Ensures all the properties in the list, with a specified amount of concurrency.
concurrentList (pure 2) "demo" $ props & foo & bar & baz
The above example will run foo and bar concurrently, and once either of those 2 properties finishes, will start running baz.
Starts accumulating a list of properties.
propertyList "foo" $ props & someproperty ! oldproperty & otherproperty