Skip to content

Commit

Permalink
Updates the swarming bot proto service comments.
Browse files Browse the repository at this point in the history
This adds comments to the supported service definition for the swarming
bots.

[email protected]
BUG=

Review-Url: https://codereview.chromium.org/2697123006
  • Loading branch information
martensryan authored and Commit bot committed Feb 21, 2017
1 parent 8f6e97d commit a8110bd
Show file tree
Hide file tree
Showing 8 changed files with 680 additions and 309 deletions.
1 change: 1 addition & 0 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def CommonChecks(input_api, output_api):
r'.+/build/.+(js|html)$',
r'/test',
r'.+_pb2\.py$',
r'.+_pb2_grpc\.py$',
r'.*third_party.*',
]
return input_api.canned_checks.PanProjectChecks(
Expand Down
1 change: 1 addition & 0 deletions appengine/swarming/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def join(*args):
] + sys.path
black_list = list(input_api.DEFAULT_BLACK_LIST) + [
r'.*_pb2\.py$',
r'.*_pb2_grpc\.py$',
]
disabled_warnings = [
'relative-import',
Expand Down
6 changes: 6 additions & 0 deletions appengine/swarming/swarming_bot/proto_bot/swarming_bot.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ syntax = "proto3";
package luci.swarming.bot;
import "google/protobuf/struct.proto";

// BotService exposes operations for interacting with remote bots/workers.
service BotService {
// Handshake implements the initial handshake from a bot to Swarming.
rpc Handshake(HandshakeRequest) returns (HandshakeResponse);
// BotUpdate requests a version of the bot code.
rpc BotUpdate(BotUpdateRequest) returns (BotUpdateResponse);
// Poll is called by a bot to request additional work.
rpc Poll(PollRequest) returns (PollResponse);
// TaskUpdate updates the state of a remote action.
rpc TaskUpdate(TaskUpdateRequest) returns (TaskUpdateResponse);
// TaskError marks a remote action as failed.
rpc TaskError(TaskErrorRequest) returns (TaskErrorResponse);
}

Expand Down
425 changes: 244 additions & 181 deletions appengine/swarming/swarming_bot/proto_bot/swarming_bot_pb2.py

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions appengine/swarming/swarming_bot/proto_bot/swarming_bot_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities

import swarming_bot_pb2 as swarming__bot__pb2


class BotServiceStub(object):
"""BotService exposes operations for interacting with remote bots/workers.
"""

def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Handshake = channel.unary_unary(
'/luci.swarming.bot.BotService/Handshake',
request_serializer=swarming__bot__pb2.HandshakeRequest.SerializeToString,
response_deserializer=swarming__bot__pb2.HandshakeResponse.FromString,
)
self.BotUpdate = channel.unary_unary(
'/luci.swarming.bot.BotService/BotUpdate',
request_serializer=swarming__bot__pb2.BotUpdateRequest.SerializeToString,
response_deserializer=swarming__bot__pb2.BotUpdateResponse.FromString,
)
self.Poll = channel.unary_unary(
'/luci.swarming.bot.BotService/Poll',
request_serializer=swarming__bot__pb2.PollRequest.SerializeToString,
response_deserializer=swarming__bot__pb2.PollResponse.FromString,
)
self.TaskUpdate = channel.unary_unary(
'/luci.swarming.bot.BotService/TaskUpdate',
request_serializer=swarming__bot__pb2.TaskUpdateRequest.SerializeToString,
response_deserializer=swarming__bot__pb2.TaskUpdateResponse.FromString,
)
self.TaskError = channel.unary_unary(
'/luci.swarming.bot.BotService/TaskError',
request_serializer=swarming__bot__pb2.TaskErrorRequest.SerializeToString,
response_deserializer=swarming__bot__pb2.TaskErrorResponse.FromString,
)


class BotServiceServicer(object):
"""BotService exposes operations for interacting with remote bots/workers.
"""

def Handshake(self, request, context):
"""Handshake implements the initial handshake from a bot to Swarming.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def BotUpdate(self, request, context):
"""BotUpdate requests a version of the bot code.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def Poll(self, request, context):
"""Poll is called by a bot to request additional work.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def TaskUpdate(self, request, context):
"""TaskUpdate updates the state of a remote action.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def TaskError(self, request, context):
"""TaskError marks a remote action as failed.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_BotServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'Handshake': grpc.unary_unary_rpc_method_handler(
servicer.Handshake,
request_deserializer=swarming__bot__pb2.HandshakeRequest.FromString,
response_serializer=swarming__bot__pb2.HandshakeResponse.SerializeToString,
),
'BotUpdate': grpc.unary_unary_rpc_method_handler(
servicer.BotUpdate,
request_deserializer=swarming__bot__pb2.BotUpdateRequest.FromString,
response_serializer=swarming__bot__pb2.BotUpdateResponse.SerializeToString,
),
'Poll': grpc.unary_unary_rpc_method_handler(
servicer.Poll,
request_deserializer=swarming__bot__pb2.PollRequest.FromString,
response_serializer=swarming__bot__pb2.PollResponse.SerializeToString,
),
'TaskUpdate': grpc.unary_unary_rpc_method_handler(
servicer.TaskUpdate,
request_deserializer=swarming__bot__pb2.TaskUpdateRequest.FromString,
response_serializer=swarming__bot__pb2.TaskUpdateResponse.SerializeToString,
),
'TaskError': grpc.unary_unary_rpc_method_handler(
servicer.TaskError,
request_deserializer=swarming__bot__pb2.TaskErrorRequest.FromString,
response_serializer=swarming__bot__pb2.TaskErrorResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'luci.swarming.bot.BotService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
1 change: 1 addition & 0 deletions client/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def join(*args):
] + sys.path
black_list = list(input_api.DEFAULT_BLACK_LIST) + [
r'.*_pb2\.py$',
r'.*_pb2_grpc\.py$',
]
output.extend(input_api.canned_checks.RunPylint(
input_api, output_api,
Expand Down
Loading

0 comments on commit a8110bd

Please sign in to comment.