-
Notifications
You must be signed in to change notification settings - Fork 28
Running example(s)
This is a runnable example at: https://ide.c9.io/agocorona/transienttest
It is a distributed program with N nodes and that is accessed with a web interface made of widgets using the transient stack. It show three different distributed applications: A map-reduce widget which count the words in a text, a federated chat server and a node monitor which display the nodes connected.
The source code of the example (less than 200 lines of code including browser interface!!!!):
https://github.com/agocorona/transient-universe/blob/master/examples/distributedApps.hs
It is necessary to sign in in Cloud9 and clone it.
In the console, execute three nodes by:
> cd transientinstaller
> ./init.sh
A cluster of three nodes will be started.
connect with the first node at port 8080 by pointing the browser to:
http://transienttest-youruser.c9users.io/
to enter in the second node: http://transienttest-youruser.c9users.io:8081
to enter in the third node: @http://transienttest-youruser.c9users.io:8082
All widgets execute in the cluster. This means that chat messages are propagated to all the nodes and you can chat across browsers connected to any of the nodes. and map-reduce requests initiated in one of the nodes are executed in the three nodes.
Warning: This example is at the limit of the capacity of the free cloud9 instance. Please do not send big queries to map-reduce. this will shut down the conections and will be no response. kill the processes and restart them again with init.hs
if you want to compile it:
> stack install ghcjs-hplay --compiler ghcjs-0.2.0.9006020_ghc-7.10.3
> stack install ghcjs-hplay
> mkdir static
> ghcjs -o static/out distributedApps.hs
> ghc distributedApps.hs
to run nodes, use init.hs as example. It run three nodes and connect them:
> cat init.hs
./distributedApps -p start/localhost/8080 &
./distributedApps -p start/localhost/8081/add/localhost/8080/y &
./distributedApps -p start/localhost/8082/add/localhost/8080/y &
There are ephimeral instances running now at: http://transienttest-agocorona.c9users.io for 24h aprox from this notice to play with them if you don't want to clone and run your own copy.
| Intro
| How-to
| Backtracking to undo IO actions and more
| Finalization: better than exceptions
| Event variables: Publish Suscribe
| Checkpoints(New), suspend and restore
| Remote execution: The Cloud monad
| Clustering: programming the cloud
| Mailboxes for cloud communications
| Distributed computing: map-reduce