ansible: log _get_file() timings.

This commit is contained in:
David Wilson 2018-04-27 10:58:33 +01:00
parent 95039eea11
commit b5be0fd65b
1 changed files with 4 additions and 2 deletions

View File

@ -43,6 +43,7 @@ import re
import stat
import subprocess
import tempfile
import time
import traceback
import zlib
@ -82,6 +83,7 @@ def _get_file(context, path, out_fp):
interrupted and the output should be discarded.
"""
LOG.debug('_get_file(): fetching %r from %r', path, context)
t0 = time.time()
recv = mitogen.core.Receiver(router=context.router)
size = mitogen.service.call(
context=context,
@ -102,8 +104,8 @@ def _get_file(context, path, out_fp):
LOG.error('get_file(%r): receiver was closed early, controller '
'is likely shutting down.', path)
LOG.debug('target.get_file(): fetched %d bytes of %r from %r',
size, path, context)
LOG.debug('target.get_file(): fetched %d bytes of %r from %r in %dms',
size, path, context, 1000*(time.time() - t0))
return out_fp.tell() == size