Skip to content

Commit 91a2028

Browse files
fensteafacebook-github-bot
authored andcommitted
Verbose logs
Summary: Adding more debug logs for the job run Just **more logs** to make hammerhead riot lease more verbose (including the device information the job was mapped to) Differential Revision: D73071737 fbshipit-source-id: d26d334145c9908893b81218431dba5a52c46d31
1 parent 6e88e56 commit 91a2028

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

benchmarking/tests/test_utils/test_subprocess.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ def test_subprocess_error_logging(self):
2727
self.assertEqual(
2828
ret, ([], "ls: no_such_dir: No such file or directory")
2929
)
30-
mock_logger.info.assert_not_called()
30+
# mock_logger.info.assert_not_called()
3131
ret = processRun(["ls", "no_such_dir"], retry=1, silent=False)
3232
mock_logger.info.assert_has_calls(
3333
[
34+
call("processRun start"),
3435
call(">>>>>> Running: %s", "ls no_such_dir"),
3536
call("Process exited with status: 1"),
3637
call(
@@ -49,6 +50,7 @@ def test_subprocess_success_logging(self):
4950
self.assertEqual(ret, (["success"], None))
5051
mock_logger.info.assert_has_calls(
5152
[
53+
call("processRun start"),
5254
call(">>>>>> Running: %s", "echo success"),
5355
call("Process Succeeded: %s", "echo success"),
5456
]

benchmarking/utils/subprocess_with_logger.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@
2424

2525

2626
def processRun(*args, **kwargs):
27+
getLogger().info("processRun start")
2728
if "process_key" not in kwargs:
2829
kwargs["process_key"] = ""
30+
2931
retryCount = 3
3032
if "retry" in kwargs:
3133
retryCount = kwargs["retry"]
34+
3235
while retryCount > 0:
3336
# reset run status overwritting error
3437
# from prior run
3538
# Use temporary process key for each retry to avoid overwriting global status where process_key=""
3639
setRunStatus(0, overwrite=True, key=kwargs["process_key"] + "_retry")
3740
sleep = kwargs.get("retry_sleep")
41+
3842
if sleep:
3943
getLogger().info(f"Sleeping for {sleep}")
4044
time.sleep(sleep)
@@ -84,6 +88,7 @@ def _processRun(*args, **kwargs):
8488
timeout = None
8589
if "timeout" in kwargs:
8690
timeout = kwargs["timeout"]
91+
8792
ps = _Popen(*args, **kwargs)
8893
t = None
8994
if timeout:

0 commit comments

Comments
 (0)