summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkfine <>2018-02-01 19:42:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-02-01 19:42:00 (GMT)
commitd5c3b113a7c7b88e1b431b1ad41258d685c976fa (patch)
tree892a5e47411af5c72676fe883a73306c8ab11aa9
parent0be36a09312da235650daf316995408efefe3e0d (diff)
version 0.3.410.3.41
-rw-r--r--src/Network/AWS/Wolf/Decide.hs21
-rw-r--r--src/Network/AWS/Wolf/SWF.hs7
-rw-r--r--wolf.cabal2
3 files changed, 16 insertions, 14 deletions
diff --git a/src/Network/AWS/Wolf/Decide.hs b/src/Network/AWS/Wolf/Decide.hs
index ca4666c..b33ae43 100644
--- a/src/Network/AWS/Wolf/Decide.hs
+++ b/src/Network/AWS/Wolf/Decide.hs
@@ -29,11 +29,11 @@ end input = do
-- | Next activity in workflow to run.
--
-next :: MonadAmazonDecision c m => Maybe Text -> Task -> m Decision
-next input t = do
+next :: MonadAmazonDecision c m => Maybe Text -> Maybe Text -> Task -> m Decision
+next input priority t = do
uid <- liftIO $ toText <$> nextRandom
traceInfo "next" [ "uid" .= uid, "task" .= t ]
- pure $ scheduleWork uid (t ^. tName) (t ^. tVersion) (t ^. tQueue) input
+ pure $ scheduleWork uid (t ^. tName) (t ^. tVersion) (t ^. tQueue) input priority
-- | Failed activity, stop the workflow.
--
@@ -48,13 +48,13 @@ completed :: MonadAmazonDecision c m => HistoryEvent -> m Decision
completed he = do
traceInfo "completed" mempty
hes <- view adcEvents
- (input, name) <- maybeThrowIO' "No Completed Information" $ do
+ (input, priority, name) <- maybeThrowIO' "No Completed Information" $ do
atcea <- he ^. heActivityTaskCompletedEventAttributes
he' <- flip find hes $ (== atcea ^. atceaScheduledEventId) . view heEventId
- name <- view atName . view atseaActivityType <$> he' ^. heActivityTaskScheduledEventAttributes
- pure (atcea ^. atceaResult, name)
+ atsea <- he' ^. heActivityTaskScheduledEventAttributes
+ pure (atcea ^. atceaResult, atsea ^. atseaTaskPriority, atsea ^. atseaActivityType ^. atName)
p <- view adcPlan
- maybe (end input) (next input) $
+ maybe (end input) (next input priority) $
join $ fmap headMay $ tailMay $ flip dropWhile (p ^. pTasks) $ (/= name) . view tName
-- | Beginning of workflow, start the first activity.
@@ -62,10 +62,11 @@ completed he = do
begin :: MonadAmazonDecision c m => HistoryEvent -> m Decision
begin he = do
traceInfo "begin" mempty
- input <- maybeThrowIO' "No Start Information" $
- view weseaInput <$> he ^. heWorkflowExecutionStartedEventAttributes
+ (input, priority) <- maybeThrowIO' "No Start Information" $ do
+ wesea <- he ^. heWorkflowExecutionStartedEventAttributes
+ pure (wesea ^. weseaInput, wesea ^. weseaTaskPriority)
p <- view adcPlan
- maybe (end input) (next input) $ headMay (p ^. pTasks)
+ maybe (end input) (next input priority) $ headMay (p ^. pTasks)
-- | Schedule workflow based on historical events.
--
diff --git a/src/Network/AWS/Wolf/SWF.hs b/src/Network/AWS/Wolf/SWF.hs
index 2050a29..ad4862e 100644
--- a/src/Network/AWS/Wolf/SWF.hs
+++ b/src/Network/AWS/Wolf/SWF.hs
@@ -94,15 +94,16 @@ completeDecision token d =
-- | Schedule decision.
--
-scheduleWork :: Text -> Text -> Text -> Text -> Maybe Text -> Decision
-scheduleWork uid name version queue input =
+scheduleWork :: Text -> Text -> Text -> Text -> Maybe Text -> Maybe Text -> Decision
+scheduleWork uid name version queue input priority =
decision ScheduleActivityTask &
dScheduleActivityTaskDecisionAttributes .~ pure satda
where
satda =
scheduleActivityTaskDecisionAttributes (activityType name version) uid &
satdaTaskList .~ pure (taskList queue) &
- satdaInput .~ input
+ satdaInput .~ input &
+ satdaTaskPriority .~ priority
-- | Complete decision.
--
diff --git a/wolf.cabal b/wolf.cabal
index b69ef63..1756403 100644
--- a/wolf.cabal
+++ b/wolf.cabal
@@ -1,5 +1,5 @@
name: wolf
-version: 0.3.40
+version: 0.3.41
synopsis: Amazon Simple Workflow Service Wrapper.
description: Wolf is a wrapper around Amazon Simple Workflow Service.
homepage: https://github.com/swift-nav/wolf