hyperion-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Hyperion.Main

Synopsis

Documentation

data HyperionOpts a Source #

The type for command-line options to hyperionMain. Here a is the type for program-specific options. In practice we want a to be an instance of Show

Constructors

HyperionMaster a

Constructor for the case of a master process, holds program-specific options

HyperionWorker Worker

Constructor for the case of a worker process, holds Worker which is parsed by workerOpts

hyperionOpts Source #

Arguments

:: Parser a

Parser for program-specific options

-> Parser (HyperionOpts a) 

Main command-line option parser for hyperionMain. Returns a Parser that supports commands "worker" and "master", and uses workerOpts or the supplied parser, respectively, to parse the remaining options

opts :: Parser a -> ParserInfo (HyperionOpts a) Source #

Same as hyperionOpts but with added --help option and wrapped into ParserInfo (by adding program description). This now can be used in execParser from Options.Applicative.

hyperionMain :: Show a => Parser a -> (a -> HyperionConfig) -> (a -> Cluster ()) -> IO () Source #

hyperionMain produces an IO () action that runs hyperion and can be assigned to main. It performs the following actions

  1. If command-line arguments start with command master then

  2. If command-line arguments start with command worker then

    • Extracts Worker from the rest of the command-line args.
    • Logs ServiceId of the worker and the system environment to worker log file.
    • Runs worker (...) :: Process () that connects to the master and waits for a ShutDown message (see worker for details). While waiting, the master can run computations on the node. Low-level functions for this are implemented in Hyperion.Remote, and some higher-level functions in Hyperion.HasWorkers