Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 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 """Tasks definition. | 6 """Tasks definition. |
| 7 | 7 |
| 8 Each user request creates a new TaskRequest. The TaskRequest instance saves the | 8 Each user request creates a new TaskRequest. The TaskRequest instance saves the |
| 9 metadata of the request, e.g. who requested it, when why, etc. It links to the | 9 metadata of the request, e.g. who requested it, when why, etc. It links to the |
| 10 actual data of the request in a TaskProperties. The TaskProperties represents | 10 actual data of the request in a TaskProperties. The TaskProperties represents |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 # Bot controlled timeout for new bytes from the subprocess. If a subprocess | 413 # Bot controlled timeout for new bytes from the subprocess. If a subprocess |
| 414 # doesn't output new data to stdout for .io_timeout_secs, consider the command | 414 # doesn't output new data to stdout for .io_timeout_secs, consider the command |
| 415 # timed out. Optional. | 415 # timed out. Optional. |
| 416 io_timeout_secs = ndb.IntegerProperty( | 416 io_timeout_secs = ndb.IntegerProperty( |
| 417 validator=_validate_timeout, indexed=False) | 417 validator=_validate_timeout, indexed=False) |
| 418 | 418 |
| 419 # If True, the task can safely be served results from a previously succeeded | 419 # If True, the task can safely be served results from a previously succeeded |
| 420 # task. | 420 # task. |
| 421 idempotent = ndb.BooleanProperty(default=False, indexed=False) | 421 idempotent = ndb.BooleanProperty(default=False, indexed=False) |
| 422 | 422 |
| 423 # A list of outputs expected. If empty, all files written to | |
| 424 # $(ISOLATED_OUTDIR) will be returned; otherwise, the files in this list | |
| 425 # will be added to those in that directory. | |
|
M-A Ruel
2016/10/26 18:47:32
# The path must be in posix form.
You must add a
| |
| 426 outputs = ndb.StringProperty(repeated=True, indexed=False) | |
| 427 | |
| 423 @property | 428 @property |
| 424 def is_terminate(self): | 429 def is_terminate(self): |
| 425 """If True, it is a terminate request.""" | 430 """If True, it is a terminate request.""" |
| 426 return ( | 431 return ( |
| 427 not self.commands and | 432 not self.commands and |
| 428 not self.command and | 433 not self.command and |
| 429 self.dimensions.keys() == [u'id'] and | 434 self.dimensions.keys() == [u'id'] and |
| 430 not (self.inputs_ref and self.inputs_ref.isolated) and | 435 not (self.inputs_ref and self.inputs_ref.isolated) and |
| 431 not self.env and | 436 not self.env and |
| 432 not self.execution_timeout_secs and | 437 not self.execution_timeout_secs and |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 850 init_new_request(request, allow_high_priority) | 855 init_new_request(request, allow_high_priority) |
| 851 return request | 856 return request |
| 852 | 857 |
| 853 | 858 |
| 854 def validate_priority(priority): | 859 def validate_priority(priority): |
| 855 """Throws ValueError if priority is not a valid value.""" | 860 """Throws ValueError if priority is not a valid value.""" |
| 856 if 0 > priority or MAXIMUM_PRIORITY < priority: | 861 if 0 > priority or MAXIMUM_PRIORITY < priority: |
| 857 raise datastore_errors.BadValueError( | 862 raise datastore_errors.BadValueError( |
| 858 'priority (%d) must be between 0 and %d (inclusive)' % | 863 'priority (%d) must be between 0 and %d (inclusive)' % |
| 859 (priority, MAXIMUM_PRIORITY)) | 864 (priority, MAXIMUM_PRIORITY)) |
| OLD | NEW |