| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The LUCI Authors. All rights reserved. | 2 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import datetime | 6 import datetime |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import random | 9 import random |
| 10 import sys | 10 import sys |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 def _gen_request(properties=None, **kwargs): | 38 def _gen_request(properties=None, **kwargs): |
| 39 """Creates a TaskRequest.""" | 39 """Creates a TaskRequest.""" |
| 40 props = { | 40 props = { |
| 41 'command': [u'command1'], | 41 'command': [u'command1'], |
| 42 'dimensions': {u'pool': u'default'}, | 42 'dimensions': {u'pool': u'default'}, |
| 43 'env': {}, | 43 'env': {}, |
| 44 'execution_timeout_secs': 24*60*60, | 44 'execution_timeout_secs': 24*60*60, |
| 45 'io_timeout_secs': None, | 45 'io_timeout_secs': None, |
| 46 } | 46 } |
| 47 props.update(properties or {}) | 47 props.update(properties or {}) |
| 48 props['dimensions_dict'] = props.pop('dimensions') |
| 48 now = utils.utcnow() | 49 now = utils.utcnow() |
| 49 args = { | 50 args = { |
| 50 'created_ts': now, | 51 'created_ts': now, |
| 51 'name': 'Request name', | 52 'name': 'Request name', |
| 52 'priority': 50, | 53 'priority': 50, |
| 53 'properties': task_request.TaskProperties(**props), | 54 'properties': task_request.TaskProperties(**props), |
| 54 'expiration_ts': now + datetime.timedelta(seconds=60), | 55 'expiration_ts': now + datetime.timedelta(seconds=60), |
| 55 'tags': [u'tag:1'], | 56 'tags': [u'tag:1'], |
| 56 'user': 'Jesus', | 57 'user': 'Jesus', |
| 57 } | 58 } |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 task_to_run.set_lookup_cache(to_run.key, True) | 602 task_to_run.set_lookup_cache(to_run.key, True) |
| 602 self.assertEqual(False, task_to_run._lookup_cache_is_taken(to_run.key)) | 603 self.assertEqual(False, task_to_run._lookup_cache_is_taken(to_run.key)) |
| 603 | 604 |
| 604 | 605 |
| 605 if __name__ == '__main__': | 606 if __name__ == '__main__': |
| 606 if '-v' in sys.argv: | 607 if '-v' in sys.argv: |
| 607 unittest.TestCase.maxDiff = None | 608 unittest.TestCase.maxDiff = None |
| 608 logging.basicConfig( | 609 logging.basicConfig( |
| 609 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) | 610 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) |
| 610 unittest.main() | 611 unittest.main() |
| OLD | NEW |