Safe Haskell | None |
---|---|
Language | Haskell2010 |
You only need this module if you want to create a new backend for distributed-dataset.
Synopsis
- newtype Backend = Backend {
- bExecute :: ByteString -> BackendM ByteString
- data BackendM a
- argExecutorMode :: String
- data ExecutorFinalStatus a
- data ExecutorStatus a
- data ExecutorPendingStatus
- waiting :: BackendM ()
- waitingDesc :: Text -> BackendM ()
- submitted :: BackendM ()
- submittedDesc :: Text -> BackendM ()
- started :: BackendM ()
- startedDesc :: Text -> BackendM ()
- throttledBackend :: MonadIO m => Int -> Backend -> m Backend
- runBackend :: Closure (Dict (Serializable i)) -> Closure (IO i) -> Backend -> IO (Handle i)
- toBackendStdin :: Closure (Dict (Serializable a)) -> Closure (IO a) -> ByteString
- fromBackendStdout :: Binary a => ByteString -> ExecutorFinalStatus a
- liftIO :: MonadIO m => IO a -> m a
- getExecutablePath :: IO FilePath
Writing a Backend
.
Backend
is responsible for running your functions in a remote environment.
Should run the current binary in the target environment, put the given
string as standard input and return the executables answer on the standard
output.
|
BackendM is essentially IO
, but also has the ability to report the status of the
executor.
Instances
argExecutorMode :: String Source #
We switch to executor mode only when argv[1] == argExecutorMode
.
Reporting status
data ExecutorFinalStatus a Source #
Instances
data ExecutorStatus a Source #
Instances
Functor ExecutorStatus Source # | |
Defined in Control.Distributed.Fork.Internal fmap :: (a -> b) -> ExecutorStatus a -> ExecutorStatus b Source # (<$) :: a -> ExecutorStatus b -> ExecutorStatus a Source # | |
Eq a => Eq (ExecutorStatus a) Source # | |
Defined in Control.Distributed.Fork.Internal (==) :: ExecutorStatus a -> ExecutorStatus a -> Bool Source # (/=) :: ExecutorStatus a -> ExecutorStatus a -> Bool Source # |
data ExecutorPendingStatus Source #
Instances
waitingDesc :: Text -> BackendM () Source #
submittedDesc :: Text -> BackendM () Source #
startedDesc :: Text -> BackendM () Source #
Utils
runBackend :: Closure (Dict (Serializable i)) -> Closure (IO i) -> Backend -> IO (Handle i) Source #
Given an IO action and a static proof that the result is Serializable
, this
function runs the action using the Backend in a separate thread and returns a
TVar
holding the ExecutorStatus
.
toBackendStdin :: Closure (Dict (Serializable a)) -> Closure (IO a) -> ByteString Source #
fromBackendStdout :: Binary a => ByteString -> ExecutorFinalStatus a Source #
Re-exports
getExecutablePath :: IO FilePath Source #
Returns the absolute pathname of the current executable.
Note that for scripts and interactive sessions, this is the path to the interpreter (e.g. ghci.)
Since base 4.11.0.0, getExecutablePath
resolves symlinks on Windows.
If an executable is launched through a symlink, getExecutablePath
returns the absolute path of the original executable.
Since: base-4.6.0.0