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

Side by Side Diff: appengine/swarming/swarming_bot/bot_code/task_runner.py

Issue 2440353004: Return specific files, not just those in $(ISOLATED_OUTDIR) (Closed)
Patch Set: Return files specified by --output in addition to those in output dir Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | client/run_isolated.py » ('j') | client/run_isolated.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Runs a Swarming task. 5 """Runs a Swarming task.
6 6
7 Downloads all the necessary files to run the task, executes the command and 7 Downloads all the necessary files to run the task, executes the command and
8 streams results back to the Swarming server. 8 streams results back to the Swarming server.
9 9
10 The process exit code is 0 when the task was executed, even if the task itself 10 The process exit code is 0 when the task was executed, even if the task itself
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 '-I', task_details.isolated['server'].encode('utf-8'), 100 '-I', task_details.isolated['server'].encode('utf-8'),
101 '--namespace', task_details.isolated['namespace'].encode('utf-8'), 101 '--namespace', task_details.isolated['namespace'].encode('utf-8'),
102 ]) 102 ])
103 isolated_input = task_details.isolated.get('input') 103 isolated_input = task_details.isolated.get('input')
104 if isolated_input: 104 if isolated_input:
105 cmd.extend( 105 cmd.extend(
106 [ 106 [
107 '--isolated', isolated_input, 107 '--isolated', isolated_input,
108 ]) 108 ])
109 109
110 for output in task_details.outputs:
111 cmd.extend(['--output', output])
112
110 if task_details.cipd_input and task_details.cipd_input.get('packages'): 113 if task_details.cipd_input and task_details.cipd_input.get('packages'):
111 for pkg in task_details.cipd_input.get('packages'): 114 for pkg in task_details.cipd_input.get('packages'):
112 cmd.extend([ 115 cmd.extend([
113 '--cipd-package', 116 '--cipd-package',
114 '%s:%s:%s' % (pkg['path'], pkg['package_name'], pkg['version'])]) 117 '%s:%s:%s' % (pkg['path'], pkg['package_name'], pkg['version'])])
115 cmd.extend( 118 cmd.extend(
116 [ 119 [
117 '--cipd-cache', os.path.join(bot_dir, 'cipd_cache'), 120 '--cipd-cache', os.path.join(bot_dir, 'cipd_cache'),
118 '--cipd-client-package', 121 '--cipd-client-package',
119 task_details.cipd_input['client_package']['package_name'], 122 task_details.cipd_input['client_package']['package_name'],
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 173
171 self.cipd_input = data.get('cipd_input') 174 self.cipd_input = data.get('cipd_input')
172 175
173 self.env = { 176 self.env = {
174 k.encode('utf-8'): v.encode('utf-8') for k, v in data['env'].iteritems() 177 k.encode('utf-8'): v.encode('utf-8') for k, v in data['env'].iteritems()
175 } 178 }
176 self.grace_period = data['grace_period'] 179 self.grace_period = data['grace_period']
177 self.hard_timeout = data['hard_timeout'] 180 self.hard_timeout = data['hard_timeout']
178 self.io_timeout = data['io_timeout'] 181 self.io_timeout = data['io_timeout']
179 self.task_id = data['task_id'] 182 self.task_id = data['task_id']
183 self.outputs = data.get('outputs', [])
180 184
181 @staticmethod 185 @staticmethod
182 def load(path): 186 def load(path):
183 """Loads the TaskDetails from a file on disk (specified via --in-file). 187 """Loads the TaskDetails from a file on disk (specified via --in-file).
184 188
185 Raises InternalError if the file can't be read or parsed. 189 Raises InternalError if the file can't be read or parsed.
186 """ 190 """
187 try: 191 try:
188 with open(path, 'rb') as f: 192 with open(path, 'rb') as f:
189 return TaskDetails(json.load(f)) 193 return TaskDetails(json.load(f))
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 options.start = now 650 options.start = now
647 651
648 try: 652 try:
649 load_and_run( 653 load_and_run(
650 options.in_file, options.swarming_server, options.cost_usd_hour, 654 options.in_file, options.swarming_server, options.cost_usd_hour,
651 options.start, options.out_file, options.min_free_space, 655 options.start, options.out_file, options.min_free_space,
652 options.bot_file, options.auth_params_file) 656 options.bot_file, options.auth_params_file)
653 return 0 657 return 0
654 finally: 658 finally:
655 logging.info('quitting') 659 logging.info('quitting')
OLDNEW
« no previous file with comments | « no previous file | client/run_isolated.py » ('j') | client/run_isolated.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698