summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkfine <>2017-12-21 03:52:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-12-21 03:52:00 (GMT)
commitf529413f79ea64b41a7e848dd8fb09b65fb9f6ab (patch)
tree6a8efe0d0b63a6174a72a514aaf55d8f81fdccaa
parent95eaa72c835ac338e1d682578dcd4ba8f3c6000b (diff)
version 0.3.380.3.38
-rw-r--r--src/Network/AWS/Wolf/Act.hs17
-rw-r--r--src/Network/AWS/Wolf/Count.hs11
-rw-r--r--src/Network/AWS/Wolf/Ctx.hs28
-rw-r--r--src/Network/AWS/Wolf/Decide.hs13
-rw-r--r--wolf.cabal153
5 files changed, 106 insertions, 116 deletions
diff --git a/src/Network/AWS/Wolf/Act.hs b/src/Network/AWS/Wolf/Act.hs
index 5ba3652..db4897b 100644
--- a/src/Network/AWS/Wolf/Act.hs
+++ b/src/Network/AWS/Wolf/Act.hs
@@ -110,12 +110,11 @@ act queue nocopy local command =
--
actMain :: MonadControl m => FilePath -> Maybe FilePath -> Text -> Int -> Bool -> Bool -> String -> m ()
actMain cf quiesce queue num nocopy local command =
- runCtx $
- runStatsCtx $ do
- conf <- readYaml cf
- runConfCtx conf $
- runConcurrent $ replicate num $ forever $ do
- ok <- check quiesce
- when ok $
- liftIO exitSuccess
- act queue nocopy local command
+ runCtx $ runTop $ do
+ conf <- readYaml cf
+ runConfCtx conf $
+ runConcurrent $ replicate num $ forever $ do
+ ok <- check quiesce
+ when ok $
+ liftIO exitSuccess
+ act queue nocopy local command
diff --git a/src/Network/AWS/Wolf/Count.hs b/src/Network/AWS/Wolf/Count.hs
index 9fb401b..89ae53c 100644
--- a/src/Network/AWS/Wolf/Count.hs
+++ b/src/Network/AWS/Wolf/Count.hs
@@ -49,9 +49,8 @@ count p =
--
countMain :: MonadControl m => FilePath -> FilePath -> m ()
countMain cf pf =
- runCtx $
- runStatsCtx $ do
- conf <- readYaml cf
- runConfCtx conf $ do
- plans <- readYaml pf
- mapM_ count (plans :: [Plan])
+ runCtx $ runTop $ do
+ conf <- readYaml cf
+ runConfCtx conf $ do
+ plans <- readYaml pf
+ mapM_ count (plans :: [Plan])
diff --git a/src/Network/AWS/Wolf/Ctx.hs b/src/Network/AWS/Wolf/Ctx.hs
index d713bf5..232d33e 100644
--- a/src/Network/AWS/Wolf/Ctx.hs
+++ b/src/Network/AWS/Wolf/Ctx.hs
@@ -4,7 +4,8 @@
{-# LANGUAGE OverloadedStrings #-}
module Network.AWS.Wolf.Ctx
- ( runConfCtx
+ ( runTop
+ , runConfCtx
, preConfCtx
, runAmazonCtx
, runAmazonStoreCtx
@@ -43,18 +44,19 @@ botErrorCatch ex = do
--
topSomeExceptionCatch :: MonadStatsCtx c m => SomeException -> m a
topSomeExceptionCatch ex = do
+ traceError "exception" [ "error" .= displayException ex ]
statsIncrement "wolf.exception" [ "reason" =. textFromString (displayException ex) ]
throwIO ex
--- | Run bottom TransT.
+-- | Run stats ctx.
--
-runBotTransT :: (MonadControl m, HasCtx c) => c -> TransT c m a -> m a
-runBotTransT c action = runTransT c $ catches action [ Handler botErrorCatch, Handler botSomeExceptionCatch ]
+runTop :: MonadCtx c m => TransT StatsCtx m a -> m a
+runTop action = runStatsCtx $ catch action topSomeExceptionCatch
--- | Run top TransT.
+-- | Run bottom TransT.
--
-runTopTransT :: (MonadControl m, HasStatsCtx c) => c -> TransT c m a -> m a
-runTopTransT c action = runBotTransT c $ catch action topSomeExceptionCatch
+runTrans :: (MonadControl m, HasCtx c) => c -> TransT c m a -> m a
+runTrans c action = runTransT c $ catches action [ Handler botErrorCatch, Handler botSomeExceptionCatch ]
-- | Run configuration context.
--
@@ -66,14 +68,14 @@ runConfCtx conf action = do
, "prefix" .= (conf ^. cPrefix)
]
c <- view statsCtx <&> cPreamble <>~ preamble
- runTopTransT (ConfCtx c conf) action
+ runTrans (ConfCtx c conf) action
-- | Update configuration context's preamble.
--
preConfCtx :: MonadConf c m => Pairs -> TransT ConfCtx m a -> m a
preConfCtx preamble action = do
c <- view confCtx <&> cPreamble <>~ preamble
- runBotTransT c action
+ runTrans c action
-- | Run amazon context.
--
@@ -85,7 +87,7 @@ runAmazonCtx action = do
#else
e <- newEnv Oregon Discover
#endif
- runBotTransT (AmazonCtx c e) action
+ runTrans (AmazonCtx c e) action
-- | Run amazon store context.
--
@@ -94,7 +96,7 @@ runAmazonStoreCtx uid action = do
let preamble = [ "uid" .= uid ]
c <- view confCtx <&> cPreamble <>~ preamble
p <- (-/- uid) . view cPrefix <$> view ccConf
- runBotTransT (AmazonStoreCtx c p) action
+ runTrans (AmazonStoreCtx c p) action
-- | Throttle throttle exceptions.
--
@@ -123,7 +125,7 @@ runAmazonWorkCtx :: MonadConf c m => Text -> TransT AmazonWorkCtx m a -> m a
runAmazonWorkCtx queue action = do
let preamble = [ "queue" .= queue ]
c <- view confCtx <&> cPreamble <>~ preamble
- runBotTransT (AmazonWorkCtx c queue) (catch action $ throttler action)
+ runTrans (AmazonWorkCtx c queue) (catch action $ throttler action)
-- | Run amazon decision context.
--
@@ -131,4 +133,4 @@ runAmazonDecisionCtx :: MonadConf c m => Plan -> [HistoryEvent] -> TransT Amazon
runAmazonDecisionCtx p hes action = do
let preamble = [ "name" .= (p ^. pStart ^. tName) ]
c <- view confCtx <&> cPreamble <>~ preamble
- runBotTransT (AmazonDecisionCtx c p hes) action
+ runTrans (AmazonDecisionCtx c p hes) action
diff --git a/src/Network/AWS/Wolf/Decide.hs b/src/Network/AWS/Wolf/Decide.hs
index 041be15..09bbbc4 100644
--- a/src/Network/AWS/Wolf/Decide.hs
+++ b/src/Network/AWS/Wolf/Decide.hs
@@ -112,10 +112,9 @@ decide p =
--
decideMain :: MonadControl m => FilePath -> FilePath -> m ()
decideMain cf pf =
- runCtx $
- runStatsCtx $ do
- conf <- readYaml cf
- runConfCtx conf $ do
- plans <- readYaml pf
- runConcurrent $
- forever . decide <$> plans
+ runCtx $ runTop $ do
+ conf <- readYaml cf
+ runConfCtx conf $ do
+ plans <- readYaml pf
+ runConcurrent $
+ forever . decide <$> plans
diff --git a/wolf.cabal b/wolf.cabal
index 1bd8c5e..f8861a1 100644
--- a/wolf.cabal
+++ b/wolf.cabal
@@ -1,93 +1,84 @@
-name: wolf
-version: 0.3.37
-cabal-version: >=1.22
-build-type: Simple
-license: MIT
-license-file: LICENSE
-copyright: Copyright (C) 2015-2016 Swift Navigation, Inc.
-maintainer: Mark Fine <dev@swiftnav.com>
-homepage: https://github.com/swift-nav/wolf
-synopsis: Amazon Simple Workflow Service Wrapper.
-description:
- Wolf is a wrapper around Amazon Simple Workflow Service.
-category: Network, AWS, Cloud, Distributed Computing
-author: Swift Navigation Inc.
+name: wolf
+version: 0.3.38
+synopsis: Amazon Simple Workflow Service Wrapper.
+description: Wolf is a wrapper around Amazon Simple Workflow Service.
+homepage: https://github.com/swift-nav/wolf
+license: MIT
+license-file: LICENSE
+author: Swift Navigation Inc.
+maintainer: Mark Fine <dev@swiftnav.com>
+copyright: Copyright (C) 2015-2016 Swift Navigation, Inc.
+category: Network, AWS, Cloud, Distributed Computing
+build-type: Simple
+cabal-version: >= 1.22
source-repository head
- type: git
- location: git@github.com:swift-nav/wolf.git
+ type: git
+ location: git@github.com:swift-nav/wolf.git
library
- exposed-modules:
- Network.AWS.Wolf
- build-depends:
- aeson >=0.11.3.0,
- amazonka >=1.4.3,
- amazonka-swf >=1.4.3,
- base >=4.8 && <5,
- bytestring >=0.10.6.0,
- conduit >=1.2.10,
- directory >=1.2.2.0,
- 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.53,
- process >=1.2.3.0,
- time >=1.5.0.1,
- uuid >=1.3.13,
- yaml >=0.8.23
- default-language: Haskell2010
- hs-source-dirs: src
- other-modules:
- Network.AWS.Wolf.Act
- Network.AWS.Wolf.Count
- Network.AWS.Wolf.Ctx
- Network.AWS.Wolf.Decide
- Network.AWS.Wolf.File
- Network.AWS.Wolf.Prelude
- Network.AWS.Wolf.SWF
- Network.AWS.Wolf.Types
- Network.AWS.Wolf.Types.Ctx
- Network.AWS.Wolf.Types.Product
- Network.AWS.Wolf.Types.Sum
- ghc-options: -Wall
+ exposed-modules: Network.AWS.Wolf
+ other-modules: Network.AWS.Wolf.Act
+ , Network.AWS.Wolf.Count
+ , Network.AWS.Wolf.Ctx
+ , Network.AWS.Wolf.Decide
+ , Network.AWS.Wolf.File
+ , Network.AWS.Wolf.Prelude
+ , Network.AWS.Wolf.SWF
+ , Network.AWS.Wolf.Types
+ , Network.AWS.Wolf.Types.Ctx
+ , Network.AWS.Wolf.Types.Product
+ , Network.AWS.Wolf.Types.Sum
+ default-language: Haskell2010
+ hs-source-dirs: src
+ ghc-options: -Wall
+ build-depends: aeson
+ , amazonka
+ , amazonka-swf
+ , base >= 4.8 && < 5
+ , bytestring
+ , conduit
+ , directory
+ , filepath
+ , http-types
+ , lifted-async
+ , lifted-base
+ , preamble
+ , process
+ , time
+ , uuid
+ , yaml
executable wolf-actor
- main-is: actor.hs
- build-depends:
- base >=4.8.2.0,
- wolf,
- optparse-generic >=1.1.5
- default-language: Haskell2010
- hs-source-dirs: main
- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ hs-source-dirs: main
+ main-is: actor.hs
+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ build-depends: base
+ , wolf
+ , optparse-generic
+ default-language: Haskell2010
executable wolf-decider
- main-is: decider.hs
- build-depends:
- base >=4.8.2.0,
- wolf,
- optparse-generic >=1.1.5
- default-language: Haskell2010
- hs-source-dirs: main
- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ hs-source-dirs: main
+ main-is: decider.hs
+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ build-depends: base
+ , wolf
+ , optparse-generic
+ default-language: Haskell2010
executable wolf-counter
- main-is: counter.hs
- build-depends:
- base >=4.8.2.0,
- wolf,
- optparse-generic >=1.1.5
- default-language: Haskell2010
- hs-source-dirs: main
- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ hs-source-dirs: main
+ main-is: counter.hs
+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ build-depends: base
+ , wolf
+ , optparse-generic
+ default-language: Haskell2010
executable shake-wolf
- main-is: Shakefile.hs
- build-depends:
- base >=4.8 && <5,
- shakers >=0.0.36
- default-language: Haskell2010
- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
-
+ main-is: Shakefile.hs
+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
+ build-depends: base >= 4.8 && < 5
+ , shakers
+ default-language: Haskell2010 \ No newline at end of file