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

Side by Side Diff: appengine/swarming/swarming_rpcs.py

Issue 2931063002: swarming: Add more documentation to task messages (Closed)
Patch Set: doc Created 3 years, 6 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 | « no previous file | 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 # Copyright 2015 The LUCI Authors. All rights reserved. 1 # Copyright 2015 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 """This module defines ProtoRPC types for the Swarming Server handlers.""" 5 """This module defines ProtoRPC types for the Swarming Server handlers."""
6 6
7 from protorpc import message_types 7 from protorpc import message_types
8 from protorpc import messages 8 from protorpc import messages
9 9
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 name = messages.StringField(1) 180 name = messages.StringField(1)
181 # Relative path to the directory that will be linked to the named cache. 181 # Relative path to the directory that will be linked to the named cache.
182 # Required. 182 # Required.
183 # A path cannot be shared among multiple caches or CIPD installations. 183 # A path cannot be shared among multiple caches or CIPD installations.
184 # A task will fail if a file/dir with the same name already exists. 184 # A task will fail if a file/dir with the same name already exists.
185 path = messages.StringField(2) 185 path = messages.StringField(2)
186 186
187 187
188 class TaskProperties(messages.Message): 188 class TaskProperties(messages.Message):
189 """Important metadata about a particular task.""" 189 """Important metadata about a particular task."""
190 # Specifies named caches to map into the working directory. These caches
191 # outlives the task, which can then be reused by tasks later used on this bot
192 # that request the same named cache.
190 caches = messages.MessageField(CacheEntry, 11, repeated=True) 193 caches = messages.MessageField(CacheEntry, 11, repeated=True)
194 # CIPD packages to install. These packages are meant to be software that is
195 # needed (a dependency) to the task being run. Unlike isolated files, the CIPD
196 # packages do not expire from the server.
191 cipd_input = messages.MessageField(CipdInput, 10) 197 cipd_input = messages.MessageField(CipdInput, 10)
198 # Command to run. This has priority over a command specified in the isolated
199 # files. Only one of 'command' or 'extra_args' can be specified.
192 command = messages.StringField(1, repeated=True) 200 command = messages.StringField(1, repeated=True)
201 # Dimensions are what is used to determine which bot can run the task. The
202 # bot must have all the matching dimensions, even for repeated keys with
203 # multiple different values. It is a logical AND, all values must match.
193 dimensions = messages.MessageField(StringPair, 2, repeated=True) 204 dimensions = messages.MessageField(StringPair, 2, repeated=True)
205 # Environment variables to set when running the task.
194 env = messages.MessageField(StringPair, 3, repeated=True) 206 env = messages.MessageField(StringPair, 3, repeated=True)
207 # Maximum number of seconds the task can run before its process is forcibly
208 # terminated and the task results in TIMED_OUT.
195 execution_timeout_secs = messages.IntegerField(4) 209 execution_timeout_secs = messages.IntegerField(4)
210 # Extraneous arguments to append to the command specified in the isolated
211 # file. Can only be used when an isolated file specifies a command. Only one
212 # of 'command' or 'extra_args' can be specified.
196 extra_args = messages.StringField(5, repeated=True) 213 extra_args = messages.StringField(5, repeated=True)
214 # Number of second to give the child process after a SIGTERM before sending a
215 # SIGKILL. See doc/Bot.md#timeout-handling
197 grace_period_secs = messages.IntegerField(6) 216 grace_period_secs = messages.IntegerField(6)
217 # True if the task does not access any service through the network and is
218 # believed to be 100% reproducible with the same outcome. In the case of a
219 # successful task, previous results will be reused if possible.
198 idempotent = messages.BooleanField(7) 220 idempotent = messages.BooleanField(7)
221 # Isolated inputs to map in the working directory. The isolated file may
222 # optionally specify a command to run. Otherwise, 'command' must be specified.
199 inputs_ref = messages.MessageField(FilesRef, 8) 223 inputs_ref = messages.MessageField(FilesRef, 8)
224 # Maximum number of seconds the task may be silent (no output to stdout nor
225 # stderr) before it is considered hung and it forcibly terminated early and
226 # the task results in TIMED_OUT.
200 io_timeout_secs = messages.IntegerField(9) 227 io_timeout_secs = messages.IntegerField(9)
228 # Paths in the working directory to archive back.
201 outputs = messages.StringField(12, repeated=True) 229 outputs = messages.StringField(12, repeated=True)
202 secret_bytes = messages.BytesField(13) # only for rpc->ndb 230 # Secret bytes to provide to the task. Cannot be retrieved back.
231 secret_bytes = messages.BytesField(13)
203 232
204 233
205 class NewTaskRequest(messages.Message): 234 class NewTaskRequest(messages.Message):
206 """Description of a new task request as described by the client.""" 235 """Description of a new task request as described by the client.
236
237 This message is used to create a new task.
238 """
239 # Maximum of seconds the task may stay PENDING.
207 expiration_secs = messages.IntegerField(1) 240 expiration_secs = messages.IntegerField(1)
241 # Task name for display purpose.
208 name = messages.StringField(2) 242 name = messages.StringField(2)
243 # Parent Swarming task ID of the process requesting this task. This is to tell
244 # the server about reentrancy: when a task creates children Swarming tasks, so
245 # that the tree of tasks can be presented in the UI; the parent task will list
246 # all the children tasks that were triggered.
209 parent_task_id = messages.StringField(3) 247 parent_task_id = messages.StringField(3)
248 # Task priority, the lower the more important.
210 priority = messages.IntegerField(4) 249 priority = messages.IntegerField(4)
250 # Task properties, which defines what to run.
211 properties = messages.MessageField(TaskProperties, 5) 251 properties = messages.MessageField(TaskProperties, 5)
252 # Tags are 'key:value' strings that describes what the task is about. This can
253 # later be leveraged to search for kinds of tasks per tag.
212 tags = messages.StringField(6, repeated=True) 254 tags = messages.StringField(6, repeated=True)
213 255 # User on which behalf this task is run, if relevant. Not validated.
214 # Arbitrary user name associated with a task for UI and tags. Not validated.
215 user = messages.StringField(7) 256 user = messages.StringField(7)
216 257
217 # Defines what OAuth2 credentials the task uses when calling other services. 258 # Defines what OAuth2 credentials the task uses when calling other services.
218 # 259 #
219 # Possible values are: 260 # Possible values are:
220 # - 'none': do not use task service accounts at all, this is default. 261 # - 'none': do not use task service accounts at all, this is default.
221 # - 'bot': use bot's own account, works only if bots authenticate with 262 # - 'bot': use bot's own account, works only if bots authenticate with
222 # OAuth2. 263 # OAuth2.
223 # - <token>: a properly signed and scoped delegation token that asserts that 264 # - <token>: a properly signed and scoped delegation token that asserts that
224 # the caller is allowed to use the specific service account (encoded in 265 # the caller is allowed to use the specific service account (encoded in
225 # the token) on Swarming. This is not implemented yet. 266 # the token) on Swarming. This is not implemented yet.
226 # 267 #
227 # Note that the service account name is specified outside of task properties, 268 # Note that the service account name is specified outside of task properties,
228 # and thus it is possible to have two tasks with different service accounts, 269 # and thus it is possible to have two tasks with different service accounts,
229 # but identical properties hash (so one can be deduped). If this is unsuitable 270 # but identical properties hash (so one can be deduped). If this is unsuitable
230 # use 'idempotent=False' or include a service account name in properties 271 # use 'idempotent=False' or include a service account name in properties
231 # separately. 272 # separately.
232 service_account_token = messages.StringField(8) 273 service_account_token = messages.StringField(8)
233 274
234 # Full topic name to post too, e.g. "projects/<id>/topics/<id>". 275 # Full topic name to post task state updates to, e.g.
276 # "projects/<id>/topics/<id>".
235 pubsub_topic = messages.StringField(9) 277 pubsub_topic = messages.StringField(9)
236 # Secret string to put into "auth_token" attribute of PubSub message. 278 # Secret string to put into "auth_token" attribute of PubSub message.
237 pubsub_auth_token = messages.StringField(10) 279 pubsub_auth_token = messages.StringField(10)
238 # Will be but into "userdata" fields of PubSub message. 280 # Will be but into "userdata" fields of PubSub message.
239 pubsub_userdata = messages.StringField(11) 281 pubsub_userdata = messages.StringField(11)
240 282
241 283
242 class TaskRequest(messages.Message): 284 class TaskRequest(messages.Message):
243 """Description of a task request as registered by the server.""" 285 """Description of a task request as registered by the server.
286
287 This message is used when retrieving information about an existing task.
288
289 See NewtaskRequest for more details.
290 """
244 expiration_secs = messages.IntegerField(1) 291 expiration_secs = messages.IntegerField(1)
245 name = messages.StringField(2) 292 name = messages.StringField(2)
246 parent_task_id = messages.StringField(3) 293 parent_task_id = messages.StringField(3)
247 priority = messages.IntegerField(4) 294 priority = messages.IntegerField(4)
248 properties = messages.MessageField(TaskProperties, 5) 295 properties = messages.MessageField(TaskProperties, 5)
249 tags = messages.StringField(6, repeated=True) 296 tags = messages.StringField(6, repeated=True)
250 created_ts = message_types.DateTimeField(7) 297 created_ts = message_types.DateTimeField(7)
251
252 # Arbitrary user name associated with a task for UI and tags. Not validated.
253 user = messages.StringField(8) 298 user = messages.StringField(8)
254 # User name of whoever posted this task, extracted from the credentials. 299 # User name of whoever posted this task, extracted from the credentials.
255 authenticated = messages.StringField(9) 300 authenticated = messages.StringField(9)
256 # Indicates what OAuth2 credentials the task uses when calling other services. 301 # Indicates what OAuth2 credentials the task uses when calling other services.
257 service_account = messages.StringField(10) 302 service_account = messages.StringField(10)
258 303
259 pubsub_topic = messages.StringField(11) 304 pubsub_topic = messages.StringField(11)
260 pubsub_userdata = messages.StringField(12) 305 pubsub_userdata = messages.StringField(12)
261 306
262 307
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 642
598 643
599 class DeletedResponse(messages.Message): 644 class DeletedResponse(messages.Message):
600 """Indicates whether a bot was deleted.""" 645 """Indicates whether a bot was deleted."""
601 deleted = messages.BooleanField(1) 646 deleted = messages.BooleanField(1)
602 647
603 648
604 class TerminateResponse(messages.Message): 649 class TerminateResponse(messages.Message):
605 """Returns the pseudo taskid to wait for the bot to shut down.""" 650 """Returns the pseudo taskid to wait for the bot to shut down."""
606 task_id = messages.StringField(1) 651 task_id = messages.StringField(1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698