Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: client/utils/tools.py

Issue 2037253002: run_isolated.py: install CIPD packages (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« client/utils/subprocess42.py ('K') | « client/utils/subprocess42.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/utils/tools.py
diff --git a/client/utils/tools.py b/client/utils/tools.py
index ab9a492c921f6226168d4db2da99ef2fe715b8fe..08476f5f9294dcd96eafdcf324e58385cc7ea366 100644
--- a/client/utils/tools.py
+++ b/client/utils/tools.py
@@ -316,3 +316,13 @@ def get_cacerts_bundle():
# to current directory instead. We use our own bundled copy of cacert.pem.
_ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.')
return _ca_certs
+
+
+class Timeouter(object):
Vadim Sh. 2016/06/06 21:32:14 not sure it's worth the dedicated class... I don't
M-A Ruel 2016/06/06 23:34:51 I agree.
nodir 2016/06/07 18:46:35 changed to a function that returns a closure
+ """Computes time left till deadline."""
+
+ def __init__(self, timeout):
+ self.deadline = time.time() + timeout if timeout is not None else None
+
+ def left(self):
+ return self.deadline - time.time() if self.deadline is not None else None
« client/utils/subprocess42.py ('K') | « client/utils/subprocess42.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698