wolf 0.3.39 → 0.3.40
raw patch · 4 files changed
+26/−14 lines, 4 files
Files
- main/actor.hs +3/−0
- src/Network/AWS/Wolf/Act.hs +16/−13
- src/Network/AWS/Wolf/Prelude.hs +6/−0
- wolf.cabal +1/−1
main/actor.hs view
@@ -30,6 +30,8 @@ -- ^ Copy working directory. , local :: Bool -- ^ Run locally, not in a temp directory.+ , include :: [FilePath]+ -- ^ Optional artifacts to filter. , command :: String -- ^ Command to run. } deriving (Show, Generic)@@ -51,4 +53,5 @@ (fromMaybe 1 $ num args) (nocopy args) (local args)+ (include args) (command args)
src/Network/AWS/Wolf/Act.hs view
@@ -22,8 +22,8 @@ -- | S3 copy call. ---cp :: MonadIO m => FilePath -> FilePath -> m ()-cp f t = liftIO $ callProcess "aws" [ "s3", "cp", "--quiet", "--recursive", f, t ]+cp :: MonadIO m => [FilePath] -> m ()+cp = liftIO . callProcess "aws" . (["s3", "cp", "--quiet", "--recursive"] <>) -- | Key to download and upload objects from. --@@ -35,17 +35,20 @@ -- | Download artifacts to the store input directory. ---download :: MonadAmazonStore c m => FilePath -> m ()-download dir = do- traceInfo "download" [ "dir" .= dir ]- flip cp dir =<< key+download :: MonadAmazonStore c m => FilePath -> [FilePath] -> m ()+download dir includes = do+ traceInfo "download" [ "dir" .= dir, "includes" .= includes ]+ let includes' = bool ([ "--exclude", "*" ] <> interleave (repeat "--include") includes) mempty $ null includes+ k <- key+ cp $ includes' <> [ k, dir ] -- | Upload artifacts from the store output directory. -- upload :: MonadAmazonStore c m => FilePath -> m () upload dir = do traceInfo "upload" [ "dir" .= dir ]- cp dir =<< key+ k <- key+ cp [ dir, k ] -- | callCommand wrapper that maybe returns an exception. --@@ -72,8 +75,8 @@ -- | Actor logic - poll for work, download artifacts, run command, upload artifacts. ---act :: MonadConf c m => Text -> Bool -> Bool -> String -> m ()-act queue nocopy local command =+act :: MonadConf c m => Text -> Bool -> Bool -> [FilePath] -> String -> m ()+act queue nocopy local includes command = preConfCtx [ "label" .= LabelAct ] $ runAmazonWorkCtx queue $ do traceInfo "poll" mempty@@ -94,7 +97,7 @@ osd <- outputDirectory sd writeJson (dd </> "control.json") (Control uid') writeText (dd </> "input.json") input- download isd+ download isd includes e <- run command upload osd output <- readText (dd </> "output.json")@@ -107,8 +110,8 @@ -- | Run actor from main with config file. ---actMain :: MonadControl m => FilePath -> Maybe FilePath -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Int -> Bool -> Bool -> String -> m ()-actMain cf quiesce domain bucket prefix queue num nocopy local command =+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 = runCtx $ runTop $ do conf <- readYaml cf let conf' = override cPrefix prefix $ override cBucket bucket $ override cDomain domain conf@@ -117,4 +120,4 @@ ok <- check quiesce when ok $ liftIO exitSuccess- act queue nocopy local command+ act queue nocopy local includes command
src/Network/AWS/Wolf/Prelude.hs view
@@ -8,6 +8,7 @@ ( module Exports , runConcurrent , override+ , interleave ) where import Control.Concurrent.Async.Lifted@@ -22,3 +23,8 @@ -- override :: ASetter s s a b -> Maybe b -> s -> s override k v c = maybe c (flip (set k) c) v++-- | Interleave arrays.+--+interleave :: [a] -> [a] -> [a]+interleave xs ys = concat $ zipWith (\x y -> [x, y]) xs ys
wolf.cabal view
@@ -1,5 +1,5 @@ name: wolf-version: 0.3.39+version: 0.3.40 synopsis: Amazon Simple Workflow Service Wrapper. description: Wolf is a wrapper around Amazon Simple Workflow Service. homepage: https://github.com/swift-nav/wolf