hsbencher 1.1.0.1 → 1.1.0.2
raw patch · 3 files changed
+37/−8 lines, 3 filesdep +http-conduit
Dependencies added: http-conduit
Files
- HSBencher/App.hs +28/−3
- HSBencher/Types.hs +5/−1
- hsbencher.cabal +4/−4
HSBencher/App.hs view
@@ -51,6 +51,9 @@ import Text.Printf import Text.PrettyPrint.GenericPretty (Out(doc)) -- import Text.PrettyPrint.HughesPJ (nest)+import Network.HTTP.Conduit (HttpException)+import qualified Control.Exception as E+ ---------------------------- -- Additional libraries: @@ -63,7 +66,7 @@ import Scripting.Parallel.ThreadPool (parForM) #ifdef FUSION_TABLES-import Network.Google (retryIORequest)+-- import Network.Google (retryIORequest) import Network.Google.OAuth2 (getCachedTokens, refreshTokens, OAuth2Client(..), OAuth2Tokens(..)) import Network.Google.FusionTables (createTable, listTables, listColumns, insertRows, TableId, CellType(..), TableMetadata(..))@@ -567,6 +570,27 @@ ) conf liftIO$ retryIORequest action retryHook [1,2,4,8,16,32,64] +-- | Takes an idempotent IO action that includes a network request. Catches+-- `HttpException`s and tries a gain a certain number of times. The second argument+-- is a callback to invoke every time a retry occurs.+-- +-- Takes a list of *seconds* to wait between retries. A null list means no retries,+-- an infinite list will retry indefinitely. The user can choose whatever temporal+-- pattern they desire (e.g. exponential backoff).+--+-- Once the retry list runs out, the last attempt may throw `HttpException`+-- exceptions that escape this function.+retryIORequest :: IO a -> (HttpException -> IO ()) -> [Double] -> IO a+retryIORequest req retryHook times = loop times+ where+ loop [] = req+ loop (delay:tl) = + E.catch req $ \ (exn::HttpException) -> do + retryHook exn+ threadDelay (round$ delay * 1000 * 1000) -- Microseconds+ loop tl++ -- | Get the table ID that has been cached on disk, or find the the table in the users -- Google Drive, or create a new table if needed. getTableId :: OAuth2Client -> String -> BenchM TableId@@ -754,8 +778,9 @@ putStrLn$ usageStr if (ShowHelp `elem` options) then exitSuccess else exitFailure - conf@Config{envs,benchlist,stdOut,threadsettings} <- getConfig options benches- + conf0 <- getConfig options []+ let conf1@Config{envs,benchlist,stdOut,threadsettings} = modConfig conf0+ hasMakefile <- doesFileExist "Makefile" cabalFile <- runLines "ls *.cabal" let hasCabalFile = (cabalFile /= []) &&
HSBencher/Types.hs view
@@ -6,9 +6,11 @@ -- * Benchmark building RunFlags, CompileFlags, FilePredicate(..), filePredCheck, BuildResult(..), BuildMethod(..),+ mkBenchmark, + Benchmark(..), -- * Benchmark configuration spaces- Benchmark(..), BenchSpace(..), ParamSetting(..),+ BenchSpace(..), ParamSetting(..), enumerateBenchSpace, compileOptsOnly, isCompileTime, toCompileFlags, toRunFlags, toEnvVars, toCmdPaths, BuildID, makeBuildID,@@ -66,6 +68,7 @@ -- directory with exactly one "Makefile". | PredOr FilePredicate FilePredicate -- ^ Logical or.+ | AnyFile -- TODO: Allow arbitrary function predicates also. deriving (Show, Generic, Ord, Eq)@@ -79,6 +82,7 @@ filePredCheck pred path = let filename = takeFileName path in case pred of+ AnyFile -> return (Just path) IsExactly str -> return$ if str == filename then Just path else Nothing WithExtension ext -> return$ if takeExtension filename == ext
hsbencher.cabal view
@@ -1,6 +1,6 @@ name: hsbencher-version: 1.1.0.1+version: 1.1.0.2 -- CHANGELOG: -- 1.0 : Initial release, new flexible benchmark format. @@ -95,7 +95,7 @@ -- unix ==2.6.*, containers ==0.5.*, time ==1.4.*, mtl ==2.1.*, async >= 2.0, base >= 4.5 && <= 4.7, bytestring, process, directory, filepath, random, unix, containers, time, mtl, async, hydra-print >= 0.1.0.3, io-streams >= 1.0,- GenericPretty >= 1.2+ GenericPretty >= 1.2, http-conduit default-language: Haskell2010 if flag(fusion) {@@ -131,7 +131,7 @@ -- <DUPLICATED from above> base >= 4.5 && <= 4.7, bytestring, process, directory, filepath, random, unix, containers, time, mtl, async, hydra-print >= 0.1.0.3, io-streams >= 1.0,- GenericPretty >= 1.2, hsbencher+ GenericPretty >= 1.2, http-conduit, hsbencher -- </DUPLICATED> ghc-options: -threaded default-language: Haskell2010@@ -144,7 +144,7 @@ -- <DUPLICATED from above> base >= 4.5 && <= 4.7, bytestring, process, directory, filepath, random, unix, containers, time, mtl, async, hydra-print >= 0.1.0.3, io-streams >= 1.0,- GenericPretty >= 1.2, hsbencher+ GenericPretty >= 1.2, http-conduit, hsbencher -- </DUPLICATED> ghc-options: -threaded default-language: Haskell2010