From f5731ed1bfdb0220a31e5e187e3a4aef973995f4 Mon Sep 17 00:00:00 2001 From: Varun Arora Date: Mon, 26 Mar 2018 08:43:46 -0700 Subject: [PATCH] [config][reporting] add new command line option job-id and log it to EventLogger Summary: New command line option job-id meant to contain the Sandcastle job id itslog - New command line option job-id meant to contain the ID of the job that Infer is running in - If the id is passed to infer, then log it with every row in EventLogger Reviewed By: dulmarod Differential Revision: D7398537 fbshipit-source-id: c5186e9 --- infer/src/base/Config.ml | 4 ++++ infer/src/base/Config.mli | 2 ++ infer/src/base/EventLogger.ml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index e7b01e318..48bfe7262 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1450,6 +1450,8 @@ and java_jar_compiler = ~meta:"path" "Specify the Java compiler jar used to generate the bytecode" +and job_id = CLOpt.mk_string_opt ~long:"job-id" "Specify the job ID of this Infer run." + and jobs = CLOpt.mk_int ~deprecated:["-multicore"] ~long:"jobs" ~short:'j' ~default:ncpu ~in_help:InferCommand.([(Analyze, manual_generic)]) @@ -2508,6 +2510,8 @@ and java_jar_compiler = !java_jar_compiler and javac_classes_out = !javac_classes_out +and job_id = !job_id + and jobs = !jobs and join_cond = !join_cond diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index edcd7a9b8..269cf669e 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -443,6 +443,8 @@ val java_jar_compiler : string option val javac_classes_out : string +val job_id : string option + val jobs : int val join_cond : int diff --git a/infer/src/base/EventLogger.ml b/infer/src/base/EventLogger.ml index 50d5ae230..34b01b835 100644 --- a/infer/src/base/EventLogger.ml +++ b/infer/src/base/EventLogger.ml @@ -316,7 +316,7 @@ module LoggerImpl : S = struct |> add_string ~key:"hostname" ~data:(Unix.gethostname ()) |> add_string ~key:"infer_commit" ~data:Version.commit |> add_int ~key:"is_originator" ~data:(if CLOpt.is_originator then 1 else 0) - |> add_int ~key:"pid" ~data:(pid ()) + |> add_string_opt ~key:"job_id" ~data:Config.job_id |> add_int ~key:"pid" ~data:(pid ()) |> add_string ~key:"run_identifier" ~data:(get_log_identifier ()) |> add_int ~key:"sequence" ~data:(!sequence_ctr - 1) |> add_string ~key:"sysname" ~data:sysname