summaryrefslogtreecommitdiff
path: root/src/Network/AWS/Wolf/Act.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/AWS/Wolf/Act.hs')
-rw-r--r--src/Network/AWS/Wolf/Act.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Network/AWS/Wolf/Act.hs b/src/Network/AWS/Wolf/Act.hs
index 20b48fa..36a3362 100644
--- a/src/Network/AWS/Wolf/Act.hs
+++ b/src/Network/AWS/Wolf/Act.hs
@@ -75,8 +75,8 @@ check = maybe (pure False) (liftIO . doesFileExist)
-- | 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 @@ act queue nocopy local includes command =
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 @@ act queue nocopy local includes command =
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