Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hyperion.Main
Synopsis
- data HyperionOpts a
- hyperionOpts :: Parser a -> Parser (HyperionOpts a)
- opts :: Parser a -> ParserInfo (HyperionOpts a)
- hyperionMain :: Show a => Parser a -> (a -> HyperionConfig) -> (a -> Cluster ()) -> IO ()
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 |
Arguments
:: Parser a |
|
-> 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
action that runs IO
()hyperion
and can be
assigned to main
. It performs the following actions
If command-line arguments start with command
master
then- Uses the supplied parser to parse the remaining options into type
a
- Uses the supplied function to extract
HyperionConfig
froma
- The data in
HyperionConfig
is then used for all following actions - Depending on
HyperionConfig
, extra actions may be performed, seenewClusterEnv
. - Starts a log in
stderr
, and then redirects it to a file - Starts a hold server from Hyperion.HoldServer
- Uses
setupKeyValTable
to setup a Hyperion.Database.KeyValMap in the program database - Runs the supplied
actionCluster
() - Cleans up the copy of the executable, if exists (see
newClusterEnv
).
- Uses the supplied parser to parse the remaining options into type
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
that connects to the master and waits for aworker
(...) ::Process
()ShutDown
message (seeworker
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
- Extracts