Clean activity logs successful completion

Status zero is normal, so don't report it.

Also don't print the log_file object.

Changes log messages such as this;

Exited with status 0, pid 3765 data (<_io.TextIOWrapper name=13 mode='w'
encoding='UTF-8'>, '5312a7726254b3b0b9a15267c54600aec9db187e')

To this;

Normal successful completion, pid 3765 activity_id 5312a7726254b3b0b9a15267c54600aec9db187e
This commit is contained in:
James Cameron 2019-08-15 16:25:57 +10:00
parent ec753badbc
commit 6e517aa3c7

View File

@ -301,7 +301,10 @@ def _child_watch_cb(pid, condition, user_data):
if os.WIFEXITED(condition): if os.WIFEXITED(condition):
status = os.WEXITSTATUS(condition) status = os.WEXITSTATUS(condition)
signum = None signum = None
message = 'Exited with status %s' % status if status == 0:
message = 'Normal successful completion'
else:
message = 'Exited with status %s' % status
elif os.WIFSIGNALED(condition): elif os.WIFSIGNALED(condition):
status = None status = None
signum = os.WTERMSIG(condition) signum = os.WTERMSIG(condition)
@ -312,7 +315,8 @@ def _child_watch_cb(pid, condition, user_data):
message = 'Undefined status with signal %s' % signum message = 'Undefined status with signal %s' % signum
try: try:
log_file.write('%s, pid %s data %s\n' % (message, pid, user_data)) log_file.write(
'%s, pid %s activity_id %s\n' % (message, pid, activity_id))
finally: finally:
log_file.close() log_file.close()