wolf 0.2.10 → 0.2.11
raw patch · 5 files changed
+8/−37 lines, 5 filesdep −stm
Dependencies removed: stm
Files
- main/Act2.hs +3/−22
- main/Options.hs +0/−8
- src/Network/AWS/Flow.hs +2/−1
- src/Network/AWS/Flow/SWF.hs +2/−2
- wolf.cabal +1/−4
main/Act2.hs view
@@ -6,9 +6,6 @@ import BasicPrelude hiding ( ByteString, (</>), (<.>), hash, length, readFile, find ) import Codec.Compression.GZip-import Control.Concurrent-import Control.Concurrent.Async-import Control.Concurrent.STM import Control.Monad.Trans.Resource import Data.Aeson.Encode import Data.ByteString ( length )@@ -16,7 +13,6 @@ import Data.Text ( pack, strip ) import Data.Text.Lazy ( toStrict ) import Data.Text.Lazy.Builder hiding ( fromText )-import Data.Time import Data.Yaml hiding ( Parser ) import Filesystem.Path ( (<.>), dropExtension ) import Network.AWS.Data.Crypto@@ -29,15 +25,13 @@ { aConfig :: FilePath , aQueue :: Queue , aCommandLine :: Text- , aTimeout :: Int } deriving ( Eq, Read, Show ) args :: Parser Args args = Args <$> configFile <*> (pack <$> queue) <*>- (pack <$> commandLine) <*>- timeout+ (pack <$> commandLine) parser :: ParserInfo Args parser =@@ -111,25 +105,12 @@ cd dir maybe (return ()) (uncurry $ run_ . fromText) $ uncons $ words cmdline -watchdog :: TVar UTCTime -> Int -> IO ()-watchdog timestamp duration =- forever $ do- now <- getCurrentTime- now' <- atomically $ readTVar timestamp- when (diffUTCTime now now' > fromIntegral duration) $- throwIO $ userError "watchdog expired"- threadDelay 1000000- call :: Args -> IO () call Args{..} = do config <- decodeFile aConfig >>= maybeThrow (userError "Bad Config") env <- flowEnv config- now <- getCurrentTime- timestamp <- atomically $ newTVar now- void $ concurrently (watchdog timestamp aTimeout) $- forever $ runResourceT $ runFlowT env $ do- liftIO $ getCurrentTime >>= atomically . writeTVar timestamp- act aQueue $ exec aCommandLine+ forever $ runResourceT $ runFlowT env $+ act aQueue $ exec aCommandLine main :: IO () main = execParser parser >>= call
main/Options.hs view
@@ -7,7 +7,6 @@ , containerless , gzip , commandLine- , timeout ) where import BasicPrelude@@ -74,10 +73,3 @@ <> metavar "COMMAND" <> help "Command to run" -timeout :: Parser Int-timeout =- option auto- $ long "timeout"- <> short 't'- <> metavar "TIMEOUT"- <> help "Timeout in seconds"
src/Network/AWS/Flow.hs view
@@ -102,8 +102,9 @@ act queue action = handle serializeError $ do logInfo' "event=act"- (token', uid, input) <- pollForActivityTaskAction queue+ (token', uid', input) <- pollForActivityTaskAction queue token <- maybeThrow (userError "No Token") token'+ uid <- maybeThrow (userError "No Uid") uid' logInfo' $ sformat ("event=act-begin uid=" % stext) uid maybe_ input $ logDebug' . sformat ("event=act-input " % stext) keys <- listObjectsAction uid
src/Network/AWS/Flow/SWF.hs view
@@ -66,7 +66,7 @@ sTaskList .~ Just (taskList queue) & sInput .~ input -pollForActivityTaskAction :: MonadFlow m => Queue -> m (Maybe Token, Uid, Metadata)+pollForActivityTaskAction :: MonadFlow m => Queue -> m (Maybe Token, Maybe Uid, Metadata) pollForActivityTaskAction queue = do timeout' <- asks fePollTimeout domain <- asks feDomain@@ -74,7 +74,7 @@ r <- send $ pollForActivityTask domain (taskList queue) return ( r ^. pfatrsTaskToken- , r ^. pfatrsWorkflowExecution ^. weWorkflowId+ , (^. weWorkflowId) <$> r ^. pfatrsWorkflowExecution , r ^. pfatrsInput ) respondActivityTaskCompletedAction :: MonadFlow m => Token -> Metadata -> m ()
wolf.cabal view
@@ -1,5 +1,5 @@ name: wolf-version: 0.2.10+version: 0.2.11 synopsis: Amazon Simple Workflow Service Wrapper. homepage: https://github.com/swift-nav/wolf license: MIT@@ -170,17 +170,14 @@ ghc-options: -Wall -main-is Act2 build-depends: aeson , amazonka-core- , async , base , basic-prelude , bytestring , optparse-applicative , resourcet , shelly- , stm , system-filepath , text- , time , transformers , wolf , yaml