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

Side by Side Diff: dm/tools/jobsim_client/generate_ensure_graph_data_req.py

Issue 2338153003: Add snapshotting for CIPD packages and dimensions to DM. (Closed)
Patch Set: Fix comments Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « dm/appengine/distributor/swarming/v1/distributor.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The LUCI Authors. All rights reserved. 2 # Copyright 2016 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 """ 6 """
7 This is a dumb script that will: 7 This is a dumb script that will:
8 * compile jobsim_client (for linux-amd64) 8 * compile jobsim_client (for linux-amd64)
9 * upload a simple cipd package containing only jobsim_client with the 'latest' 9 * upload a simple cipd package containing only jobsim_client with the 'latest'
10 ref. The package name is 'infra/experimental/dm/jobsim_client/linux-amd64'. 10 ref. The package name is 'infra/experimental/dm/jobsim_client/linux-amd64'.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 }, 94 },
95 ] 95 ]
96 } 96 }
97 } 97 }
98 } 98 }
99 }, 99 },
100 'command': command, 100 'command': command,
101 } 101 }
102 } 102 }
103 103
104 if opts.snapshot_dimension:
105 distParams['scheduling']['snapshot_dimensions'] = opts.snapshot_dimension
106
104 params = { 107 params = {
105 'a': opts.a, 108 'a': opts.a,
106 'b': opts.b, 109 'b': opts.b,
107 } 110 }
108 111
109 desc = { 112 desc = {
110 'quest': [ 113 'quest': [
111 { 114 {
112 'distributor_config_name': 'swarming', 115 'distributor_config_name': 'swarming',
113 'parameters': dumps(params), 116 'parameters': dumps(params),
(...skipping 27 matching lines...) Expand all
141 'platform', 'Options for the target platform of the job.') 144 'platform', 'Options for the target platform of the job.')
142 plat_grp.add_argument('--os', choices=('linux',), default='linux', 145 plat_grp.add_argument('--os', choices=('linux',), default='linux',
143 help='The OS to compile/run on.') 146 help='The OS to compile/run on.')
144 plat_grp.add_argument('--arch', choices=('amd64',), default='amd64', 147 plat_grp.add_argument('--arch', choices=('amd64',), default='amd64',
145 help='The Arch to compile/run on.') 148 help='The Arch to compile/run on.')
146 plat_grp.add_argument('--pool', type=str, default='default', 149 plat_grp.add_argument('--pool', type=str, default='default',
147 help='The swarming pool to use.') 150 help='The swarming pool to use.')
148 plat_grp.add_argument('--pin', action='store_true', default=False, 151 plat_grp.add_argument('--pin', action='store_true', default=False,
149 help='Emit the request with a pinned package version' 152 help='Emit the request with a pinned package version'
150 ' instead of "latest".') 153 ' instead of "latest".')
154 plat_grp.add_argument(
155 '--snapshot-dimension', action='append', help=(
156 'Pin this dimension on re-executions. This will cause re-executions to '
157 'copy the most-specific value of this dependency from the first '
158 'execution to all subsequent re-executions of the same Attempt. May be '
159 'specified multiple times.'
160 ))
151 161
152 cipd_grp = parser.add_argument_group('cipd', 'cipd packaging options') 162 cipd_grp = parser.add_argument_group('cipd', 'cipd packaging options')
153 cipd_grp.add_argument('--cipd-service-url', default=None, 163 cipd_grp.add_argument('--cipd-service-url', default=None,
154 help='The CIPD service to upload to.') 164 help='The CIPD service to upload to.')
155 cipd_grp.add_argument('--cipd-service-account-json', default=None, 165 cipd_grp.add_argument('--cipd-service-account-json', default=None,
156 help='The CIPD service account JSON file to use.') 166 help='The CIPD service account JSON file to use.')
157 cipd_grp.add_argument('--cipd-name', 167 cipd_grp.add_argument('--cipd-name',
158 default='infra/experimental/dm/jobsim_client', 168 default='infra/experimental/dm/jobsim_client',
159 help='The CIPD package name prefix to upload to. This ' 169 help='The CIPD package name prefix to upload to. This '
160 'will be appended with the standard os-arch suffix.') 170 'will be appended with the standard os-arch suffix.')
161 171
162 opts = parser.parse_args() 172 opts = parser.parse_args()
163 173
164 # Use local path for determinisim. 174 # Use local path for determinisim.
165 pkg_dir = os.path.join(THIS_DIR, 'pkg_dir') 175 pkg_dir = os.path.join(THIS_DIR, 'pkg_dir')
166 shutil.rmtree(pkg_dir, ignore_errors=True) 176 shutil.rmtree(pkg_dir, ignore_errors=True)
167 os.mkdir(pkg_dir) 177 os.mkdir(pkg_dir)
168 try: 178 try:
169 compile_pkg(pkg_dir, opts.os, opts.arch) 179 compile_pkg(pkg_dir, opts.os, opts.arch)
170 pkg_name, version = upload_pkg(pkg_dir, opts.cipd_name, opts.os, opts.arch) 180 pkg_name, version = upload_pkg(pkg_dir, opts.cipd_name, opts.os, opts.arch)
171 print_req(opts, pkg_name, version) 181 print_req(opts, pkg_name, version)
172 finally: 182 finally:
173 shutil.rmtree(pkg_dir, ignore_errors=True) 183 shutil.rmtree(pkg_dir, ignore_errors=True)
174 184
175 185
176 if __name__ == '__main__': 186 if __name__ == '__main__':
177 main() 187 main()
OLDNEW
« no previous file with comments | « dm/appengine/distributor/swarming/v1/distributor.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698