packages feed

wolf 0.3.32 → 0.3.33

raw patch · 9 files changed

+67/−97 lines, 9 filesdep −exceptionsdep −filemanipdep ~preambledep ~shakers

Dependencies removed: exceptions, filemanip

Dependency ranges changed: preamble, shakers

Files

Shakefile.hs view
@@ -38,7 +38,7 @@   -- | sanity   --   fake "." pats "sanity" $ const $-    need [ "build-error", "lint" ]+    need [ "build-error", "lint", "weed" ]    -- | Default things to run.   --
src/Network/AWS/Wolf/Act.hs view
@@ -75,36 +75,35 @@ act :: MonadConf c m => Text -> Bool -> Bool -> String -> m () act queue nocopy local command =   preConfCtx [ "label" .= LabelAct ] $-    runAmazonCtx $-      runAmazonWorkCtx queue $ do-        traceInfo "poll" mempty-        t0 <- liftIO getCurrentTime-        (token, uid, input) <- pollActivity-        t1 <- liftIO getCurrentTime-        statsIncrement "wolf.act.poll.count" [ "queue" =. queue ]-        statsHistogram "wolf.act.poll.elapsed" (realToFrac (diffUTCTime t1 t0) :: Double) [ "queue" =. queue ]-        maybe_ token $ \token' ->-          maybe_ uid $ \uid' ->-            withCurrentWorkDirectory uid' nocopy local $ \wd ->-              runAmazonStoreCtx uid' $ do-                traceInfo "start" [ "dir" .= wd ]-                t2  <- liftIO getCurrentTime-                dd  <- dataDirectory wd-                sd  <- storeDirectory wd-                isd <- inputDirectory sd-                osd <- outputDirectory sd-                writeJson (dd </> "control.json") (Control uid')-                writeText (dd </> "input.json") input-                download isd-                e <- run command-                upload osd-                output <- readText (dd </> "output.json")-                maybe (completeActivity token' output) (const $ failActivity token') e-                t3 <- liftIO getCurrentTime-                traceInfo "finish" [ "dir" .= wd ]-                let status = textFromString $ maybe "complete" (const "fail") e-                statsIncrement "wolf.act.activity.count" [ "queue" =. queue, "status" =. status ]-                statsHistogram "wolf.act.activity.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]+    runAmazonWorkCtx queue $ do+      traceInfo "poll" mempty+      t0 <- liftIO getCurrentTime+      (token, uid, input) <- pollActivity+      t1 <- liftIO getCurrentTime+      statsIncrement "wolf.act.poll.count" [ "queue" =. queue ]+      statsHistogram "wolf.act.poll.elapsed" (realToFrac (diffUTCTime t1 t0) :: Double) [ "queue" =. queue ]+      maybe_ token $ \token' ->+        maybe_ uid $ \uid' ->+          withCurrentWorkDirectory uid' nocopy local $ \wd ->+            runAmazonStoreCtx uid' $ do+              traceInfo "start" [ "dir" .= wd ]+              t2  <- liftIO getCurrentTime+              dd  <- dataDirectory wd+              sd  <- storeDirectory wd+              isd <- inputDirectory sd+              osd <- outputDirectory sd+              writeJson (dd </> "control.json") (Control uid')+              writeText (dd </> "input.json") input+              download isd+              e <- run command+              upload osd+              output <- readText (dd </> "output.json")+              maybe (completeActivity token' output) (const $ failActivity token') e+              t3 <- liftIO getCurrentTime+              traceInfo "finish" [ "dir" .= wd ]+              let status = textFromString $ maybe "complete" (const "fail") e+              statsIncrement "wolf.act.activity.count" [ "queue" =. queue, "status" =. status ]+              statsHistogram "wolf.act.activity.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]   -- | Run actor from main with config file.
src/Network/AWS/Wolf/Count.hs view
@@ -41,10 +41,9 @@ -- count :: MonadConf c m => Plan -> m () count p =-  preConfCtx [ "label" .= LabelCount ] $-    runAmazonCtx $ do-      countDecision (p ^. pStart)-      mapM_ countActivity (p ^. pTasks)+  preConfCtx [ "label" .= LabelCount ] $ do+    countDecision (p ^. pStart)+    mapM_ countActivity (p ^. pTasks)  -- | Run counter from main with config file. --
src/Network/AWS/Wolf/Ctx.hs view
@@ -77,9 +77,9 @@  -- | Run amazon context. ---runAmazonCtx :: MonadConf c m => TransT AmazonCtx m a -> m a+runAmazonCtx :: MonadCtx c m => TransT AmazonCtx m a -> m a runAmazonCtx action = do-  c <- view confCtx+  c <- view ctx #if MIN_VERSION_amazonka(1,4,5)   e <- newEnv Discover #else@@ -94,7 +94,7 @@   let preamble = [ "uid" .= uid ]   c <- view confCtx <&> cPreamble <>~ preamble   p <- (-/- uid) . view cPrefix <$> view ccConf-  runBotTransT (AmazonStoreCtx c uid p) action+  runBotTransT (AmazonStoreCtx c p) action  -- | Throttle throttle exceptions. --
src/Network/AWS/Wolf/Decide.hs view
@@ -88,26 +88,25 @@ -- decide :: MonadConf c m => Plan -> m () decide p =-  preConfCtx [ "label" .= LabelDecide ] $-    runAmazonCtx $ do-      let queue = p ^. pStart ^. tQueue-      runAmazonWorkCtx queue $ do-        traceInfo "poll" mempty-        t0 <- liftIO getCurrentTime-        (token, hes) <- pollDecision-        t1 <- liftIO getCurrentTime-        statsIncrement "wolf.decide.poll.count" [ "queue" =. queue ]-        statsHistogram "wolf.decide.poll.elapsed" (realToFrac (diffUTCTime t1 t0) :: Double) [ "queue" =. queue ]-        maybe_ token $ \token' ->-          runAmazonDecisionCtx p hes $ do-            traceInfo "start" mempty-            t2 <- liftIO getCurrentTime-            schedule >>=-              completeDecision token'-            t3 <- liftIO getCurrentTime-            traceInfo "finish" mempty-            statsIncrement "wolf.decide.decision.count" [ "queue" =. queue ]-            statsHistogram "wolf.decide.decision.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]+  preConfCtx [ "label" .= LabelDecide ] $ do+    let queue = p ^. pStart ^. tQueue+    runAmazonWorkCtx queue $ do+      traceInfo "poll" mempty+      t0 <- liftIO getCurrentTime+      (token, hes) <- pollDecision+      t1 <- liftIO getCurrentTime+      statsIncrement "wolf.decide.poll.count" [ "queue" =. queue ]+      statsHistogram "wolf.decide.poll.elapsed" (realToFrac (diffUTCTime t1 t0) :: Double) [ "queue" =. queue ]+      maybe_ token $ \token' ->+        runAmazonDecisionCtx p hes $ do+          traceInfo "start" mempty+          t2 <- liftIO getCurrentTime+          schedule >>=+            completeDecision token'+          t3 <- liftIO getCurrentTime+          traceInfo "finish" mempty+          statsIncrement "wolf.decide.decision.count" [ "queue" =. queue ]+          statsHistogram "wolf.decide.decision.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]  -- | Run decider from main with config file. --
src/Network/AWS/Wolf/File.hs view
@@ -4,9 +4,7 @@ -- | Files, directories, and encoding / decoding file functions. -- module Network.AWS.Wolf.File-  ( findRegularFiles-  , touchDirectory-  , dataDirectory+  ( dataDirectory   , storeDirectory   , inputDirectory   , outputDirectory@@ -22,23 +20,9 @@ import qualified Data.ByteString.Lazy     as LBS import           Data.Time import           Data.Yaml                hiding (encode)-import           Network.AWS.Wolf.Prelude hiding (find)+import           Network.AWS.Wolf.Prelude import           System.Directory-import           System.FilePath-import           System.FilePath.Find import           System.IO                hiding (readFile, writeFile)---- | Recursively find all files under a directory.----findRegularFiles :: MonadIO m => FilePath -> m [FilePath]-findRegularFiles =-  liftIO . find always (fileType ==? RegularFile)---- | Create parent directory of file if missing.----touchDirectory :: MonadIO m => FilePath -> m ()-touchDirectory =-  liftIO . createDirectoryIfMissing True . takeDirectory  -- | Determine path to data directory and create it. --
src/Network/AWS/Wolf/Types/Ctx.hs view
@@ -41,28 +41,22 @@ -- Amazon context. -- data AmazonCtx = AmazonCtx-  { _acConfCtx :: ConfCtx+  { _acCtx :: Ctx     -- ^ Parent context.-  , _acEnv     :: Env+  , _acEnv :: Env     -- ^ Amazon environment.   } -$(makeClassyConstraints ''AmazonCtx [''HasConfCtx, ''HasEnv])--instance HasConfCtx AmazonCtx where-  confCtx = acConfCtx--instance HasStatsCtx AmazonCtx where-  statsCtx = confCtx . statsCtx+$(makeClassyConstraints ''AmazonCtx [''HasCtx, ''HasEnv])  instance HasCtx AmazonCtx where-  ctx = statsCtx . ctx+  ctx = acCtx  instance HasEnv AmazonCtx where   environment = acEnv  type MonadAmazon c m =-  ( MonadConf c m+  ( MonadCtx c m   , HasAmazonCtx c   , AWSConstraint c m   )@@ -74,8 +68,6 @@ data AmazonStoreCtx = AmazonStoreCtx   { _ascConfCtx :: ConfCtx     -- ^ Parent context.-  , _ascUid     :: Text-    -- ^ Workflow uid.   , _ascPrefix  :: Text     -- ^ Object prefix.   }@@ -83,7 +75,7 @@ $(makeClassyConstraints ''AmazonStoreCtx [''HasConfCtx])  instance HasConfCtx AmazonStoreCtx where-   confCtx = ascConfCtx+  confCtx = ascConfCtx  instance HasStatsCtx AmazonStoreCtx where   statsCtx = confCtx . statsCtx
src/Network/AWS/Wolf/Types/Sum.hs view
@@ -13,8 +13,7 @@ -- Tags for referencing workers. -- data LabelType-  = LabelWolf-  | LabelAct+  = LabelAct   | LabelDecide   | LabelCount   deriving (Show, Eq)
wolf.cabal view
@@ -1,5 +1,5 @@ name: wolf-version: 0.3.32+version: 0.3.33 cabal-version: >=1.22 build-type: Simple license: MIT@@ -28,13 +28,11 @@         bytestring >=0.10.6.0,         conduit >=1.2.10,         directory >=1.2.2.0,-        exceptions >=0.8.3,-        filemanip >=0.3.6.3,         filepath >=1.4.0.0,         http-types >=0.9.1,         lifted-async >=0.9.1.1,         lifted-base >=0.2.3.11,-        preamble >=0.0.51,+        preamble >=0.0.52,         process >=1.2.3.0,         time >=1.5.0.1,         uuid >=1.3.13,@@ -89,7 +87,7 @@     main-is: Shakefile.hs     build-depends:         base >=4.8 && <5,-        shakers >=0.0.35+        shakers >=0.0.36     default-language: Haskell2010     ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall