packages feed

wolf 0.3.46 → 0.3.47

raw patch · 4 files changed

+26/−13 lines, 4 files

Files

main/actor.hs view
@@ -14,6 +14,8 @@ data Args = Args   { config  :: FilePath     -- ^ Configuration file.+  , storeconf :: Bool+    -- ^ Optional copy configuration file to output dorectory. (default: False)   , quiesce :: Maybe FilePath     -- ^ Optional quiesce file to stop actor.   , domain  :: Maybe Text@@ -22,14 +24,14 @@     -- ^ Optional bucket to use.   , prefix  :: Maybe Text     -- ^ Optional prefix to use.-  , queue   :: Text+  , queue   :: [Text]     -- ^ Queue to listen to act on.   , num     :: Maybe Int     -- ^ Number of actors to run concurrently.   , nocopy  :: Bool-    -- ^ Copy working directory.+    -- ^ Copy working directory. (default: False)   , local   :: Bool-    -- ^ Run locally, not in a temp directory.+    -- ^ Run locally, not in a temp directory. (default: False)   , include :: [FilePath]     -- ^ Optional artifacts to filter.   , command :: String@@ -45,6 +47,7 @@   args <- getRecord "Actor"   actMain     (config args)+    (storeconf args)     (quiesce args)     (domain args)     (bucket args)
src/Network/AWS/Wolf/Act.hs view
@@ -75,8 +75,8 @@  -- | Actor logic - poll for work, download artifacts, run command, upload artifacts. ---act :: MonadConf c m => Text -> Bool -> Bool -> [FilePath] -> String -> m ()-act queue nocopy local includes command =+act :: MonadConf c m => Text -> Bool -> Bool -> [FilePath] -> String -> Bool -> m ()+act queue nocopy local includes command storeconf =   preConfCtx [ "label" .= LabelAct ] $     runAmazonWorkCtx queue $ do       traceInfo "poll" mempty@@ -96,6 +96,8 @@               isd <- inputDirectory sd               osd <- outputDirectory sd               msd <- metaDirectory sd+              conf <- view ccConf+              when storeconf (writeYaml (osd </> "config.yml") conf)               writeJson (dd </> "control.json") (Control uid')               writeText (dd </> "input.json") input               writeText (msd </> (textToString queue <> "_input.json")) input@@ -111,16 +113,18 @@               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. ---actMain :: MonadControl m => FilePath -> Maybe FilePath -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Int -> Bool -> Bool -> [FilePath] -> String -> m ()-actMain cf quiesce domain bucket prefix queue num nocopy local includes command =+actMain :: MonadControl m => FilePath -> Bool -> Maybe FilePath -> Maybe Text -> Maybe Text -> Maybe Text -> [Text] -> Int -> Bool -> Bool -> [FilePath] -> String -> m ()+actMain cf storeconf quiesce domain bucket prefix queues num nocopy local includes command =   runCtx $ runTop $ do     conf <- readYaml cf     let conf' = override cPrefix prefix $ override cBucket bucket $ override cDomain domain conf     runConfCtx conf' $-      runConcurrent $ replicate num $ forever $ do-        ok <- check quiesce-        when ok $-          liftIO exitSuccess-        act queue nocopy local includes command+      runConcurrent $ replicate num $ forever $+        forM_ (cycle queues) $ \queue -> do+          ok <- check quiesce+          when ok $+            liftIO exitSuccess+          act queue nocopy local includes command storeconf
src/Network/AWS/Wolf/File.hs view
@@ -12,6 +12,7 @@   , writeText   , readText   , writeJson+  , writeYaml   , readYaml   , withCurrentWorkDirectory   ) where@@ -87,6 +88,11 @@ writeJson file item =   liftIO $ withFile file WriteMode $ \h ->     BS.hPut h $ LBS.toStrict $ encode item++-- | Encode from YAML and write file.+--+writeYaml :: (MonadIO m, ToJSON a) => FilePath -> a -> m ()+writeYaml file item = liftIO $ encodeFile file item  -- | Read file and decode it from YAML. --
wolf.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.22 name: wolf-version: 0.3.46+version: 0.3.47 license: MIT license-file: LICENSE copyright: Copyright (C) 2015-2016 Swift Navigation, Inc.