82186ca58f
Added the ability to run one job per CPU (core), by setting annex.jobs=cpus, or using option --jobs=cpus or -Jcpus. Built with future expansion in mind, including not defaulting matching on Concurrency so more constructors can later be added, and using "cpu" instead of "0".
15 lines
426 B
Haskell
15 lines
426 B
Haskell
{- Copyright 2016 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
|
-}
|
|
|
|
module Types.Concurrency where
|
|
|
|
import Utility.PartialPrelude
|
|
|
|
data Concurrency = NonConcurrent | Concurrent Int | ConcurrentPerCpu
|
|
|
|
parseConcurrency :: String -> Maybe Concurrency
|
|
parseConcurrency "cpus" = Just ConcurrentPerCpu
|
|
parseConcurrency "cpu" = Just ConcurrentPerCpu
|
|
parseConcurrency s = Concurrent <$> readish s
|