Skip to content

Instantly share code, notes, and snippets.

@nc6
Created December 19, 2014 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nc6/aa74ed1b1117b01b5d2f to your computer and use it in GitHub Desktop.
Save nc6/aa74ed1b1117b01b5d2f to your computer and use it in GitHub Desktop.
dumpNodeStats bug report.
-- 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
{-# 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
{-# 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
import Distribution.Simple
main = defaultMain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment