]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
queue: only git fetch once per minute per branch 51/head
authorSage Weil <sage@inktank.com>
Fri, 23 Aug 2013 22:43:35 +0000 (15:43 -0700)
committerSage Weil <sage@inktank.com>
Fri, 23 Aug 2013 22:43:35 +0000 (15:43 -0700)
This takes 1-2 seconds and makes launching jobs slow.  Only do it once
every 60 seconds per branch.

Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/queue.py

index 9ee812d7b6261f83d1b8d8d5b243de9d622f9880..f7d8aee529c42029a21095a855ec72f6dbbf6535 100644 (file)
@@ -55,12 +55,18 @@ def fetch_teuthology_branch(path, branch='master'):
                                          teuthology_git_upstream, path),
                                         cwd=os.getenv("HOME"))
                 )
-        else:
+        elif time.time() - os.stat('/etc/passwd').st_mtime > 60:
+            # only do this at most once per minute
             log.info("Fetching %s from upstream", branch)
             log.info(
                 subprocess.check_output(('git', 'fetch', '-p', 'origin'),
                                         cwd=path)
                 )
+            log.info(
+                subprocess.check_output(('touch', path))
+                )
+        else:
+            log.info("%s was just updated; assuming it is current", branch)
 
         # This try/except block will notice if the requested branch doesn't
         # exist, whether it was cloned or fetched.