amazon web services - CloudHaskell running on AWS -
i have created 3 ec2 ubuntu instances on aws , trying run code:
module main remotabledecl [ [d| distribute :: ([nodeid], int) -> process () distribute (slaves, x) = let x' = mymath x nextnode = slaves !! (x' `mod` (length slaves)) $ show x ++ " - 1 = " ++ show x' unless (x' == 0) $ void $ spawn nextnode $ $(mkclosure 'distribute) (slaves, mymath x) |]] remotetable = __remotetabledecl initremotetable master :: backend -> [nodeid] -> process () master backend slaves = liftio . putstrln $ "slaves: " ++ show slaves distribute (slaves, 15) terminateallslaves backend main :: io () main = prog <- getprogname args <- getargs case args of ["master", host, port] -> backend <- initializebackend host port remotetable startmaster backend (master backend) ["slave", host, port] -> backend <- initializebackend host port remotetable startslave backend
by these commands stated here https://hackage.haskell.org/package/distributed-process-simplelocalnet-0.2.3.2/docs/control-distributed-process-backend-simplelocalnet.html
$ stack exec -- test slave 172.31.3.226 8080 &
$ stack exec -- test slave 172.31.3.227 8080 &
$ stack exec -- test master 172.31.3.228 8080
ips private ips of aws instances. when run master, there no slaves connected. output:
slaves: []
tue jul 26 17:45:04 utc 2016 pid://172.31.3.228:8000:0:10: 15 - 1 = 14
test: divide zero
there should slaves connected in output, there not.
Comments
Post a Comment