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

Unified Diff: client/swarming.py

Issue 2636993002: swarming: Fix named cache support. (Closed)
Patch Set: Fix swarming_test.py Created 3 years, 11 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
« no previous file with comments | « client/named_cache.py ('k') | client/tests/swarming_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/swarming.py
diff --git a/client/swarming.py b/client/swarming.py
index b147c34d363ab4a2437ba79a0dc07f98f83dd6f1..90552540bdeec72e384b61b641e4fff22a66eccd 100755
--- a/client/swarming.py
+++ b/client/swarming.py
@@ -5,7 +5,7 @@
"""Client tool to trigger tasks or retrieve results from a Swarming server."""
-__version__ = '0.8.8'
+__version__ = '0.8.9'
import collections
import datetime
@@ -165,6 +165,7 @@ FilesRef = collections.namedtuple(
TaskProperties = collections.namedtuple(
'TaskProperties',
[
+ 'caches',
'cipd_input',
'command',
'dimensions',
@@ -887,7 +888,7 @@ def abort_task(_swarming, _manifest):
def add_filter_options(parser):
- parser.filter_group = optparse.OptionGroup(parser, 'Filtering slaves')
+ parser.filter_group = optparse.OptionGroup(parser, 'Bot selection')
parser.filter_group.add_option(
'-d', '--dimension', default=[], action='append', nargs=2,
dest='dimensions', metavar='FOO bar',
@@ -908,70 +909,76 @@ def add_trigger_options(parser):
isolateserver.add_isolate_server_options(parser)
add_filter_options(parser)
- parser.task_group = optparse.OptionGroup(parser, 'Task properties')
- parser.task_group.add_option(
+ group = optparse.OptionGroup(parser, 'Task properties')
+ group.add_option(
'-s', '--isolated',
help='Hash of the .isolated to grab from the isolate server')
- parser.task_group.add_option(
+ group.add_option(
'-e', '--env', default=[], action='append', nargs=2, metavar='FOO bar',
help='Environment variables to set')
- parser.task_group.add_option(
- '--priority', type='int', default=100,
- help='The lower value, the more important the task is')
- parser.task_group.add_option(
- '-T', '--task-name',
- help='Display name of the task. Defaults to '
- '<base_name>/<dimensions>/<isolated hash>/<timestamp> if an '
- 'isolated file is provided, if a hash is provided, it defaults to '
- '<user>/<dimensions>/<isolated hash>/<timestamp>')
- parser.task_group.add_option(
- '--tags', action='append', default=[],
- help='Tags to assign to the task.')
- parser.task_group.add_option(
- '--user', default='',
- help='User associated with the task. Defaults to authenticated user on '
- 'the server.')
- parser.task_group.add_option(
+ group.add_option(
'--idempotent', action='store_true', default=False,
help='When set, the server will actively try to find a previous task '
'with the same parameter and return this result instead if possible')
- parser.task_group.add_option(
+ group.add_option(
'--secret-bytes-path',
help='The optional path to a file containing the secret_bytes to use with'
'this task.')
- parser.task_group.add_option(
- '--expiration', type='int', default=6*60*60,
- help='Seconds to allow the task to be pending for a bot to run before '
- 'this task request expires.')
- parser.task_group.add_option(
- '--deadline', type='int', dest='expiration',
- help=optparse.SUPPRESS_HELP)
- parser.task_group.add_option(
+ group.add_option(
'--hard-timeout', type='int', default=60*60,
help='Seconds to allow the task to complete.')
- parser.task_group.add_option(
+ group.add_option(
'--io-timeout', type='int', default=20*60,
help='Seconds to allow the task to be silent.')
- parser.task_group.add_option(
+ group.add_option(
'--raw-cmd', action='store_true', default=False,
help='When set, the command after -- is used as-is without run_isolated. '
'In this case, no .isolated file is expected.')
- parser.task_group.add_option(
+ group.add_option(
'--cipd-package', action='append', default=[],
help='CIPD packages to install on the Swarming bot. Uses the format: '
'path:package_name:version')
- parser.task_group.add_option(
+ group.add_option(
+ '--named-cache', action='append', nargs=2, default=[],
+ help='"<name> <relpath>" items to keep a persistent bot managed cache')
+ group.add_option(
'--service-account',
help='Name of a service account to run the task as. Only literal "bot" '
'string can be specified currently (to run the task under bot\'s '
'account). Don\'t use task service accounts if not given '
'(default).')
- parser.task_group.add_option(
+ group.add_option(
'-o', '--output', action='append', default=[],
help='A list of files to return in addition to those written to'
'$(ISOLATED_OUTDIR). An error will occur if a file specified by'
'this option is also written directly to $(ISOLATED_OUTDIR).')
- parser.add_option_group(parser.task_group)
+ parser.add_option_group(group)
+
+ group = optparse.OptionGroup(parser, 'Task request')
+ group.add_option(
+ '--priority', type='int', default=100,
+ help='The lower value, the more important the task is')
+ group.add_option(
+ '-T', '--task-name',
+ help='Display name of the task. Defaults to '
+ '<base_name>/<dimensions>/<isolated hash>/<timestamp> if an '
+ 'isolated file is provided, if a hash is provided, it defaults to '
+ '<user>/<dimensions>/<isolated hash>/<timestamp>')
+ group.add_option(
+ '--tags', action='append', default=[],
+ help='Tags to assign to the task.')
+ group.add_option(
+ '--user', default='',
+ help='User associated with the task. Defaults to authenticated user on '
+ 'the server.')
+ group.add_option(
+ '--expiration', type='int', default=6*60*60,
+ help='Seconds to allow the task to be pending for a bot to run before '
+ 'this task request expires.')
+ group.add_option(
+ '--deadline', type='int', dest='expiration',
+ help=optparse.SUPPRESS_HELP)
+ parser.add_option_group(group)
def process_trigger_options(parser, options, args):
@@ -1029,10 +1036,15 @@ def process_trigger_options(parser, options, args):
with open(options.secret_bytes_path, 'r') as f:
secret_bytes = f.read().encode('base64')
+ caches = [
+ {u'name': unicode(i[0]), u'path': unicode(i[1])}
+ for i in options.named_cache
+ ]
# If inputs_ref.isolated is used, command is actually extra_args.
# Otherwise it's an actual command to run.
isolated_input = inputs_ref and inputs_ref.isolated
properties = TaskProperties(
+ caches=caches,
cipd_input=cipd_input,
command=None if isolated_input else command,
dimensions=options.dimensions,
« no previous file with comments | « client/named_cache.py ('k') | client/tests/swarming_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698