Commit a37ab322 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Pass the debug level to forked jobs



When forking off jobs, make them inherit the debug level
of the parent process (i.e., of luxid). In this way, we
can debug jobs in test clusters without cluttering production
logs. We pass the debug level through the environment instead
of the startup dialog with the parent, as we would like to
be able to debug the startup dialog.

While there, fix the call of SetupLogging: the debug parameter
is supposed to be an int.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 908e1be4
......@@ -57,12 +57,15 @@ def _GetMasterInfo():
def main():
debug = int (os.environ["GNT_DEBUG"])
logname = pathutils.GetLogFilename("jobs")
utils.SetupLogging(logname, "job-startup", debug=True) # TODO
utils.SetupLogging(logname, "job-startup", debug=debug)
(job_id, livelock_name) = _GetMasterInfo()
utils.SetupLogging(logname, "job-%s" % (job_id,), debug=True) # TODO
utils.SetupLogging(logname, "job-%s" % (job_id,), debug=debug)
exit_code = 1
try:
......
......@@ -141,7 +141,10 @@ runJobProcess jid s = withErrorLogAt CRITICAL (show jid) $
-- we pass the job id as the first argument to the process;
-- while the process never uses it, it's very convenient when listing
-- job processes
env <- (M.insert "PYTHONPATH" AC.versionedsharedir . M.fromList)
use_debug <- isDebugMode
env <- (M.insert "GNT_DEBUG" (if use_debug then "1" else "0")
. M.insert "PYTHONPATH" AC.versionedsharedir
. M.fromList)
`liftM` getEnvironment
execPy <- P.jqueueExecutorPy
logDebug $ "Executing " ++ AC.pythonPath ++ " " ++ execPy
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment