ganeti
Safe HaskellNone

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 requests any secret parameters.
  • MP sends the secret parameters, if any.
  • Both MP and FP close the communication channel.
Synopsis

Documentation

rethrowAnnotateIOError :: String -> IO a -> IO a Source #

Catches a potential IOError and sets its description via annotateIOError. This makes exceptions more informative when they are thrown from an unnamed Handle.

spawnJobProcess :: JobId -> IO (ProcessID, Client) Source #

Spawn a subprocess to execute a Job's actual code in the Python interpreter. The subprocess will have its standard input and output connected to a pair of pipes wrapped in a Client instance. Standard error will be inherited from the current process and can be used for early logging, before the executor sets up its own logging.

forkJobProcess Source #

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.