Showing
1 changed file
with
11 additions
and
2 deletions
... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
13 | 13 | ||
14 | import logging | 14 | import logging |
15 | import os | 15 | import os |
16 | +import time | ||
16 | import zipfile | 17 | import zipfile |
17 | 18 | ||
18 | from botocore.exceptions import ClientError | 19 | from botocore.exceptions import ClientError |
... | @@ -92,9 +93,17 @@ class Function(object): | ... | @@ -92,9 +93,17 @@ class Function(object): |
92 | self._log = kappa.log.Log(self._context, log_group_name) | 93 | self._log = kappa.log.Log(self._context, log_group_name) |
93 | return self._log | 94 | return self._log |
94 | 95 | ||
95 | - def tail(self): | 96 | + def tail(self, attempt=0): |
97 | + try: | ||
96 | LOG.debug('tailing function: %s', self.name) | 98 | LOG.debug('tailing function: %s', self.name) |
97 | - return self.log.tail() | 99 | + log_result = self.log.tail() |
100 | + return log_result | ||
101 | + except Exception, e: | ||
102 | + if attempt > 10: | ||
103 | + return e | ||
104 | + else: | ||
105 | + time.sleep(attempt) | ||
106 | + return self.tail(attempt+1) | ||
98 | 107 | ||
99 | def _zip_lambda_dir(self, zipfile_name, lambda_dir): | 108 | def _zip_lambda_dir(self, zipfile_name, lambda_dir): |
100 | LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir) | 109 | LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir) | ... | ... |
-
Please register or login to post a comment