ganeti

Safe HaskellSafe-Infered

Ganeti.Query.Exec

Description

Executing jobs as processes

The protocol works as follows (MP = master process, FP = forked process):

  • MP sets its own livelock as the livelock of the job to be executed.
  • FP creates its own lock file and sends its name to the MP.
  • MP updates the lock file name in the job file and confirms the FP it can start.
  • FP calls executeFile and replaces the process with a Python process
  • FP sends an empty message to the MP to signal it's ready to receive the necessary information.
  • MP sends the FP its job ID.
  • FP sends an empty message to the MP again.
  • MP sends the FP its live lock file name (since it was known only to the Haskell process, but not the Python process).
  • Both MP and FP close the communication channel.

Synopsis

Documentation

listOpenFds :: Error e => ResultT e IO [Fd]Source

rethrowAnnotateIOError :: String -> IO a -> IO aSource

forkWithPipe :: ConnectConfig -> (Client -> IO ()) -> IO (ProcessID, Client)Source

forkJobProcessSource

Arguments

:: (Error e, Show e) 
=> QueuedJob

a job to process

-> FilePath

the daemons own livelock file

-> (FilePath -> ResultT e IO ())

a callback function to update the livelock file and process id in the job file

-> ResultT e IO (FilePath, ProcessID) 

Forks the job process and starts processing of the given job. Returns the livelock of the job and its process ID.