forked from agocorona/Workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
re-startable monad that recover the execution state from a log, and workflow patterns
License
silky/Workflow
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A workflow can be seen as a persistent thread. The workflow monad writes a log that permit to restore the thread at the interrupted point. step is the (partial) monad transformer for the Workflow monad. A workflow is defined by its name and, optionally by the key of the single parameter passed. There primitives for starting workflows also restart the interrupted workflow when it has been in execution previously. A small example that print the sequence of integers in te console if you interrupt the progam, when restarted again, it will start from the last printed number module Main where import Control.Workflow import Control.Concurrent(threadDelay) import System.IO (hFlush,stdout) mcount n= do step $ do putStr (show n ++ " ") hFlush stdout threadDelay 1000000 mcount (n+1) return () -- to disambiguate the return type main= exec1 "count" $ mcount (0 :: Int) >>> runghc demos\sequence.hs >0 1 2 3 >CTRL-C Pressed >>> runghc demos\sequence.hs >3 4 5 6 7 >CTRL-C Pressed >>> runghc demos\sequence.hs >7 8 9 10 11 ... The program restart at the last saved step. As you can see, some side effect can be re-executed after recovery if the log is not complete. This may happen after an unexpected shutdown (in this case) or due to an asynchronous log writing policy. (see syncWrite) When the step results are big and complex, use the Data.RefSerialize package to define the (de)serialization instances The log size will be reduced. printWFHistory` method will print the structure changes in each step. If instead of RefSerialize, you use read and show instances, there will be no reduction. but still it will work, and the log will be readable for debugging purposes. The RefSerialize istance is automatically derived from Read, Show instances. Data.Binary instances are also fine for serialization. To use Binary, just define a binary instance of your data by using showpBinary and readpBinary. Within the RefSerialize instance of a structure, you can freely mix Show,Read RefSerialize and Data Binary instances. Control.Workflow.Patterns contains higuer level workflow patters of multiuser workflows Control.Workflow.Configuration permits the use of workflows for configuration purposes
About
re-startable monad that recover the execution state from a log, and workflow patterns
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Haskell 100.0%