-- -*- indent-tabs-mode: nil -*- --
-- Initial hs-cctools-workqueue.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: cctools-workqueue
version: 3.6.1.0.1.0.0.1
synopsis: High-level interface to CCTools' WorkQueue library
description: This package provides a high-level Haskell interface to the WorkQueue library:
.
.
Work Queue is a framework for building large
master-worker applications that span many
computers including clusters, clouds, and
grids. Work Queue applications are written in C,
Perl, or Python using a simple API that allows
users to define tasks, submit them to the queue,
and wait for completion. Tasks are executed by a
standard worker process that can run on any
available machine. Each worker calls home to the
master process, arranges for data transfer, and
executes the tasks. Together, the master and
worker handle a wide variety of failures,
allowing for dynamically scalable and robust
applications.
.
<>
.
.
Example usage:
.
By default the master listens on 9123 on the localhost host.
Start a worker:
.
> $ work_queue_worker -d all localhost 9123
.
Now we can execute the following master program:
.
> module Main where
>
> import Control.Distributed.CCTools.WorkQueue
>
> import Control.Applicative ((<$>))
> import qualified Data.ByteString.Char8 as BS (pack, putStrLn)
> import Foreign.C.String (newCStringLen)
> import Control.Monad (forM_)
>
>
>
> mktask :: Show a => a -> IO Task
> mktask v = do
> let script = BS.pack . unlines $ [
> "t=$(echo $RANDOM % 10 | bc)"
> , "sleep $t"
> , "echo " ++ show v
> ]
> t <- task $ cmd "bash script.sh"
> specifyBuffer t script (remote "script.sh") False
> specifyTag t $ show v
> return t
>
> printStats :: WorkQueue -> IO ()
> printStats q = do
> s <- getStats q
> print $ map ($ s) [tasksRunning, tasksWaiting, tasksComplete]
>
> processResult :: WorkQueue -> Task -> IO ()
> processResult q r = do
> putStrLn $ "Got: " ++ show (tag r)
> BS.putStrLn . output $ r
> delete r
>
> main = do
> setDebugFlags [All]
> q <- workqueue defaultQParams
> ts <- mapM mktask [1..10]
> forM_ ts (submit q)
>
> eventLoop q (seconds 1) printStats processResult
>
> putStrLn "Done!"
license: GPL-2
license-file: LICENSE
author: Badi' Abdul-Wahid
maintainer: abdulwahidc@gmail.com
-- copyright:
category: Distributed Computing
build-type: Simple
cabal-version: >=1.8
homepage: http://bitbucket.org/badi/hs-cctools-workqueue
source-repository head
type: git
location: git@bitbucket.org:badi/hs-cctools-workqueue.git
flag warn
description: Turn on warnings
default: False
library
exposed-modules: Control.Distributed.CCTools.WorkQueue.Task
, Control.Distributed.CCTools.WorkQueue.Types
, Control.Distributed.CCTools.WorkQueue.WorkQueue
, Control.Distributed.CCTools.WorkQueue.Debug
, Control.Distributed.CCTools.WorkQueue
other-modules: Control.Distributed.CCTools.WorkQueue.Internal.Cast
, Control.Distributed.CCTools.WorkQueue.Internal.Types
, Control.Distributed.CCTools.WorkQueue.Internal.CastInstances
, Control.Distributed.CCTools.WorkQueue.Internal.Task
, Control.Distributed.CCTools.WorkQueue.Internal.WorkQueue
, Control.Distributed.CCTools.WorkQueue.Internal.Debug
if impl(ghc == 7.4.*)
build-depends: base ==4.5.*
if impl(ghc == 7.6.*)
build-depends: base ==4.6.*
build-depends: bindings-cctools == 3.6.1.0.1.*
, lens
, unix
, bytestring
, monad-loops
extra-libraries: dttools
ghc-options: -O3 -funbox-strict-fields
if flag(warn)
ghc-options: -W
-fwarn-duplicate-exports -fwarn-incomplete-patterns -fwarn-incomplete-uni-patterns
-fwarn-incomplete-record-updates -fwarn-missing-fields -fwarn-missing-signatures
-fwarn-name-shadowing -fwarn-tabs -fwarn-unused-imports -fwarn-unused-matches
-fwarn-warnings-deprecations