Created
December 19, 2014 12:10
-
-
Save nc6/aa74ed1b1117b01b5d2f to your computer and use it in GitHub Desktop.
dumpNodeStats bug report.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Initial dumpNodeStats.cabal generated by cabal init. For further | |
-- documentation, see http://haskell.org/cabal/users-guide/ | |
name: dumpNodeStats | |
version: 0.1.0.0 | |
synopsis: Tool to dump stats from a CH node to the console. | |
-- description: | |
license: AllRightsReserved | |
license-file: LICENSE | |
author: Nicholas Clarke | |
maintainer: nicholas.clarke@seagate.com | |
-- copyright: | |
category: Testing | |
build-type: Simple | |
-- extra-source-files: | |
cabal-version: >=1.10 | |
executable server | |
main-is: Server.hs | |
build-depends: base >=4.7 && <4.8 | |
,network-transport | |
,network-transport-tcp | |
,distributed-process | |
-- hs-source-dirs: | |
default-language: Haskell2010 | |
executable dumpNodeStats | |
main-is: Main.hs | |
-- other-modules: | |
-- other-extensions: | |
build-depends: base >=4.7 && <4.8 | |
,network-transport | |
,network-transport-tcp | |
,distributed-process | |
-- hs-source-dirs: | |
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE LambdaCase #-} | |
module Main where | |
import Control.Applicative | |
import Control.Distributed.Process | |
import Control.Distributed.Process.Node | |
import qualified Network.Transport.TCP as TCP | |
import System.Environment (getArgs) | |
myHost :: String | |
myHost = "127.0.0.1" | |
myPort :: String | |
myPort = "6666" | |
conjureRemoteNodeId :: String -> String -> NodeId | |
conjureRemoteNodeId host port = | |
NodeId $ TCP.encodeEndPointAddress host port 0 | |
main :: IO () | |
main = getArgs >>= \case | |
(host : port : []) -> let nid = conjureRemoteNodeId host port in do | |
print $ "Talking to " ++ show nid | |
transport <- either (error . show) id <$> | |
TCP.createTransport myHost myPort TCP.defaultTCPParameters | |
lnid <- newLocalNode transport initRemoteTable | |
runProcess lnid $ do | |
say "Querying NodeStats...." | |
Right ns <- getNodeStats nid | |
liftIO $ print ns | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE LambdaCase #-} | |
module Main where | |
import Control.Applicative | |
import Control.Distributed.Process | |
import Control.Distributed.Process.Node | |
import qualified Network.Transport.TCP as TCP | |
import System.Environment (getArgs) | |
myHost :: String | |
myHost = "127.0.0.1" | |
myPort :: String | |
myPort = "6665" | |
conjureRemoteNodeId :: String -> String -> NodeId | |
conjureRemoteNodeId host port = | |
NodeId $ TCP.encodeEndPointAddress host port 0 | |
main :: IO () | |
main = do | |
transport <- either (error . show) id <$> | |
TCP.createTransport myHost myPort TCP.defaultTCPParameters | |
lnid <- newLocalNode transport initRemoteTable | |
runProcess lnid $ do | |
say "Sitting here doing nothing...." | |
expect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Distribution.Simple | |
main = defaultMain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment