Commit e98ad40e authored by Stanislav Bohm's avatar Stanislav Bohm

ENH: Basic error propagation

parent 37ba5dcb
from .client import Client # noqa
from .client import Client, LoomException, TaskFailed # noqa
from .plan import Plan # noqa
......@@ -7,6 +7,20 @@ from plan import Task
LOOM_PROTOCOL_VERSION = 1
class LoomException(Exception):
pass
class TaskFailed(LoomException):
def __init__(self, id, worker, error_msg):
self.id = id
self.worker = worker
self.error_msg = error_msg
message = "Task id={} failed: {}".format(id, error_msg)
LoomException.__init__(self, message)
class Client(object):
def __init__(self, address, port, info=False):
......@@ -51,15 +65,21 @@ class Client(object):
if cmsg.type == ClientMessage.DATA:
prologue = cmsg.data
data[prologue.id] = self._receive_data()
else:
assert cmsg.type == ClientMessage.INFO
elif cmsg.type == ClientMessage.INFO:
self.add_info(cmsg.info)
elif cmsg.type == ClientMessage.ERROR:
self.process_error(cmsg)
if single_result:
return data[results.id]
else:
return [data[task.id] for task in results]
def process_error(self, cmsg):
assert cmsg.HasField("error")
error = cmsg.error
raise TaskFailed(error.id, error.worker, error.error_msg)
def add_info(self, info):
self.info.append((info.id, info.worker))
......
......@@ -18,7 +18,7 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='loomcomm.proto',
package='loomcomm',
serialized_pb=_b('\n\x0eloomcomm.proto\x12\x08loomcomm\"\xbb\x01\n\x08Register\x12\x18\n\x10protocol_version\x18\x01 \x02(\x05\x12%\n\x04type\x18\x02 \x02(\x0e\x32\x17.loomcomm.Register.Type\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x12\n\ntask_types\x18\x04 \x03(\t\x12\x0c\n\x04\x63pus\x18\x05 \x01(\x05\x12\x0c\n\x04info\x18\n \x01(\x08\"0\n\x04Type\x12\x13\n\x0fREGISTER_WORKER\x10\x01\x12\x13\n\x0fREGISTER_CLIENT\x10\x02\"&\n\rServerMessage\"\x15\n\x04Type\x12\r\n\tSTART_JOB\x10\x01\"\xf1\x01\n\rWorkerCommand\x12*\n\x04type\x18\x01 \x02(\x0e\x32\x1c.loomcomm.WorkerCommand.Type\x12\n\n\x02id\x18\x02 \x01(\x05\x12\x11\n\ttask_type\x18\x03 \x01(\x05\x12\x13\n\x0btask_config\x18\x04 \x01(\t\x12\x13\n\x0btask_inputs\x18\x05 \x03(\x05\x12\x0f\n\x07\x61\x64\x64ress\x18\n \x01(\t\x12\x11\n\twith_size\x18\x0b \x01(\x08\x12\x0f\n\x07symbols\x18\x64 \x03(\t\"6\n\x04Type\x12\x08\n\x04TASK\x10\x01\x12\x08\n\x04SEND\x10\x02\x12\n\n\x06REMOVE\x10\x03\x12\x0e\n\nDICTIONARY\x10\x04\"\x1c\n\x0eWorkerResponse\x12\n\n\x02id\x18\x02 \x01(\x05\"\x18\n\x08\x41nnounce\x12\x0c\n\x04port\x18\x01 \x02(\x05\"-\n\x0c\x44\x61taPrologue\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x11\n\tdata_size\x18\x03 \x01(\x04\";\n\x04\x44\x61ta\x12\x0f\n\x07type_id\x18\x01 \x02(\x05\x12\x10\n\x08\x61rg0_u64\x18\x02 \x01(\x04\x12\x10\n\x08\x61rg1_u64\x18\x03 \x01(\x04\"\"\n\x04Info\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x0e\n\x06worker\x18\x02 \x02(\t\"\x9b\x01\n\rClientMessage\x12*\n\x04type\x18\x01 \x02(\x0e\x32\x1c.loomcomm.ClientMessage.Type\x12$\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x16.loomcomm.DataPrologue\x12\x1c\n\x04info\x18\x03 \x01(\x0b\x32\x0e.loomcomm.Info\"\x1a\n\x04Type\x12\x08\n\x04\x44\x41TA\x10\x01\x12\x08\n\x04INFO\x10\x02\x42\x02H\x03')
serialized_pb=_b('\n\x0eloomcomm.proto\x12\x08loomcomm\"\xbb\x01\n\x08Register\x12\x18\n\x10protocol_version\x18\x01 \x02(\x05\x12%\n\x04type\x18\x02 \x02(\x0e\x32\x17.loomcomm.Register.Type\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x12\n\ntask_types\x18\x04 \x03(\t\x12\x0c\n\x04\x63pus\x18\x05 \x01(\x05\x12\x0c\n\x04info\x18\n \x01(\x08\"0\n\x04Type\x12\x13\n\x0fREGISTER_WORKER\x10\x01\x12\x13\n\x0fREGISTER_CLIENT\x10\x02\"&\n\rServerMessage\"\x15\n\x04Type\x12\r\n\tSTART_JOB\x10\x01\"\xf1\x01\n\rWorkerCommand\x12*\n\x04type\x18\x01 \x02(\x0e\x32\x1c.loomcomm.WorkerCommand.Type\x12\n\n\x02id\x18\x02 \x01(\x05\x12\x11\n\ttask_type\x18\x03 \x01(\x05\x12\x13\n\x0btask_config\x18\x04 \x01(\t\x12\x13\n\x0btask_inputs\x18\x05 \x03(\x05\x12\x0f\n\x07\x61\x64\x64ress\x18\n \x01(\t\x12\x11\n\twith_size\x18\x0b \x01(\x08\x12\x0f\n\x07symbols\x18\x64 \x03(\t\"6\n\x04Type\x12\x08\n\x04TASK\x10\x01\x12\x08\n\x04SEND\x10\x02\x12\n\n\x06REMOVE\x10\x03\x12\x0e\n\nDICTIONARY\x10\x04\"|\n\x0eWorkerResponse\x12+\n\x04type\x18\x01 \x02(\x0e\x32\x1d.loomcomm.WorkerResponse.Type\x12\n\n\x02id\x18\x02 \x02(\x05\x12\x11\n\terror_msg\x18\x03 \x01(\t\"\x1e\n\x04Type\x12\n\n\x06\x46INISH\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\"\x18\n\x08\x41nnounce\x12\x0c\n\x04port\x18\x01 \x02(\x05\"-\n\x0c\x44\x61taPrologue\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x11\n\tdata_size\x18\x03 \x01(\x04\";\n\x04\x44\x61ta\x12\x0f\n\x07type_id\x18\x01 \x02(\x05\x12\x10\n\x08\x61rg0_u64\x18\x02 \x01(\x04\x12\x10\n\x08\x61rg1_u64\x18\x03 \x01(\x04\"\"\n\x04Info\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x0e\n\x06worker\x18\x02 \x02(\t\"6\n\x05\x45rror\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x0e\n\x06worker\x18\x02 \x02(\t\x12\x11\n\terror_msg\x18\x03 \x02(\t\"\xc6\x01\n\rClientMessage\x12*\n\x04type\x18\x01 \x02(\x0e\x32\x1c.loomcomm.ClientMessage.Type\x12$\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x16.loomcomm.DataPrologue\x12\x1c\n\x04info\x18\x03 \x01(\x0b\x32\x0e.loomcomm.Info\x12\x1e\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x0f.loomcomm.Error\"%\n\x04Type\x12\x08\n\x04\x44\x41TA\x10\x01\x12\x08\n\x04INFO\x10\x02\x12\t\n\x05\x45RROR\x10\x03\x42\x02H\x03')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
......@@ -94,6 +94,28 @@ _WORKERCOMMAND_TYPE = _descriptor.EnumDescriptor(
)
_sym_db.RegisterEnumDescriptor(_WORKERCOMMAND_TYPE)
_WORKERRESPONSE_TYPE = _descriptor.EnumDescriptor(
name='Type',
full_name='loomcomm.WorkerResponse.Type',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='FINISH', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FAILED', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=596,
serialized_end=626,
)
_sym_db.RegisterEnumDescriptor(_WORKERRESPONSE_TYPE)
_CLIENTMESSAGE_TYPE = _descriptor.EnumDescriptor(
name='Type',
full_name='loomcomm.ClientMessage.Type',
......@@ -108,11 +130,15 @@ _CLIENTMESSAGE_TYPE = _descriptor.EnumDescriptor(
name='INFO', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ERROR', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=832,
serialized_end=858,
serialized_start=1016,
serialized_end=1053,
)
_sym_db.RegisterEnumDescriptor(_CLIENTMESSAGE_TYPE)
......@@ -295,17 +321,32 @@ _WORKERRESPONSE = _descriptor.Descriptor(
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='loomcomm.WorkerResponse.id', index=0,
number=2, type=5, cpp_type=1, label=1,
name='type', full_name='loomcomm.WorkerResponse.type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='id', full_name='loomcomm.WorkerResponse.id', index=1,
number=2, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='error_msg', full_name='loomcomm.WorkerResponse.error_msg', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_WORKERRESPONSE_TYPE,
],
options=None,
is_extendable=False,
......@@ -313,7 +354,7 @@ _WORKERRESPONSE = _descriptor.Descriptor(
oneofs=[
],
serialized_start=502,
serialized_end=530,
serialized_end=626,
)
......@@ -342,8 +383,8 @@ _ANNOUNCE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=532,
serialized_end=556,
serialized_start=628,
serialized_end=652,
)
......@@ -379,8 +420,8 @@ _DATAPROLOGUE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=558,
serialized_end=603,
serialized_start=654,
serialized_end=699,
)
......@@ -423,8 +464,8 @@ _DATA = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=605,
serialized_end=664,
serialized_start=701,
serialized_end=760,
)
......@@ -460,8 +501,52 @@ _INFO = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=666,
serialized_end=700,
serialized_start=762,
serialized_end=796,
)
_ERROR = _descriptor.Descriptor(
name='Error',
full_name='loomcomm.Error',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='loomcomm.Error.id', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='worker', full_name='loomcomm.Error.worker', index=1,
number=2, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='error_msg', full_name='loomcomm.Error.error_msg', index=2,
number=3, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=798,
serialized_end=852,
)
......@@ -493,6 +578,13 @@ _CLIENTMESSAGE = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='error', full_name='loomcomm.ClientMessage.error', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
......@@ -505,8 +597,8 @@ _CLIENTMESSAGE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=703,
serialized_end=858,
serialized_start=855,
serialized_end=1053,
)
_REGISTER.fields_by_name['type'].enum_type = _REGISTER_TYPE
......@@ -514,9 +606,12 @@ _REGISTER_TYPE.containing_type = _REGISTER
_SERVERMESSAGE_TYPE.containing_type = _SERVERMESSAGE
_WORKERCOMMAND.fields_by_name['type'].enum_type = _WORKERCOMMAND_TYPE
_WORKERCOMMAND_TYPE.containing_type = _WORKERCOMMAND
_WORKERRESPONSE.fields_by_name['type'].enum_type = _WORKERRESPONSE_TYPE
_WORKERRESPONSE_TYPE.containing_type = _WORKERRESPONSE
_CLIENTMESSAGE.fields_by_name['type'].enum_type = _CLIENTMESSAGE_TYPE
_CLIENTMESSAGE.fields_by_name['data'].message_type = _DATAPROLOGUE
_CLIENTMESSAGE.fields_by_name['info'].message_type = _INFO
_CLIENTMESSAGE.fields_by_name['error'].message_type = _ERROR
_CLIENTMESSAGE_TYPE.containing_type = _CLIENTMESSAGE
DESCRIPTOR.message_types_by_name['Register'] = _REGISTER
DESCRIPTOR.message_types_by_name['ServerMessage'] = _SERVERMESSAGE
......@@ -526,6 +621,7 @@ DESCRIPTOR.message_types_by_name['Announce'] = _ANNOUNCE
DESCRIPTOR.message_types_by_name['DataPrologue'] = _DATAPROLOGUE
DESCRIPTOR.message_types_by_name['Data'] = _DATA
DESCRIPTOR.message_types_by_name['Info'] = _INFO
DESCRIPTOR.message_types_by_name['Error'] = _ERROR
DESCRIPTOR.message_types_by_name['ClientMessage'] = _CLIENTMESSAGE
Register = _reflection.GeneratedProtocolMessageType('Register', (_message.Message,), dict(
......@@ -584,6 +680,13 @@ Info = _reflection.GeneratedProtocolMessageType('Info', (_message.Message,), dic
))
_sym_db.RegisterMessage(Info)
Error = _reflection.GeneratedProtocolMessageType('Error', (_message.Message,), dict(
DESCRIPTOR = _ERROR,
__module__ = 'loomcomm_pb2'
# @@protoc_insertion_point(class_scope:loomcomm.Error)
))
_sym_db.RegisterMessage(Error)
ClientMessage = _reflection.GeneratedProtocolMessageType('ClientMessage', (_message.Message,), dict(
DESCRIPTOR = _CLIENTMESSAGE,
__module__ = 'loomcomm_pb2'
......
......@@ -24,6 +24,7 @@ void protobuf_ShutdownFile_loomcomm_2eproto() {
delete DataPrologue::default_instance_;
delete Data::default_instance_;
delete Info::default_instance_;
delete Error::default_instance_;
delete ClientMessage::default_instance_;
}
......@@ -47,6 +48,7 @@ void protobuf_AddDesc_loomcomm_2eproto() {
DataPrologue::default_instance_ = new DataPrologue();
Data::default_instance_ = new Data();
Info::default_instance_ = new Info();
Error::default_instance_ = new Error();
ClientMessage::default_instance_ = new ClientMessage();
Register::default_instance_->InitAsDefaultInstance();
ServerMessage::default_instance_->InitAsDefaultInstance();
......@@ -56,6 +58,7 @@ void protobuf_AddDesc_loomcomm_2eproto() {
DataPrologue::default_instance_->InitAsDefaultInstance();
Data::default_instance_->InitAsDefaultInstance();
Info::default_instance_->InitAsDefaultInstance();
Error::default_instance_->InitAsDefaultInstance();
ClientMessage::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_loomcomm_2eproto);
}
......@@ -1120,8 +1123,27 @@ void WorkerCommand::Swap(WorkerCommand* other) {
// ===================================================================
bool WorkerResponse_Type_IsValid(int value) {
switch(value) {
case 1:
case 2:
return true;
default:
return false;
}
}
#ifndef _MSC_VER
const WorkerResponse_Type WorkerResponse::FINISH;
const WorkerResponse_Type WorkerResponse::FAILED;
const WorkerResponse_Type WorkerResponse::Type_MIN;
const WorkerResponse_Type WorkerResponse::Type_MAX;
const int WorkerResponse::Type_ARRAYSIZE;
#endif // _MSC_VER
#ifndef _MSC_VER
const int WorkerResponse::kTypeFieldNumber;
const int WorkerResponse::kIdFieldNumber;
const int WorkerResponse::kErrorMsgFieldNumber;
#endif // !_MSC_VER
WorkerResponse::WorkerResponse()
......@@ -1141,8 +1163,11 @@ WorkerResponse::WorkerResponse(const WorkerResponse& from)
}
void WorkerResponse::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
type_ = 1;
id_ = 0;
error_msg_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
......@@ -1152,6 +1177,9 @@ WorkerResponse::~WorkerResponse() {
}
void WorkerResponse::SharedDtor() {
if (error_msg_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete error_msg_;
}
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if (this != &default_instance()) {
#else
......@@ -1181,7 +1209,15 @@ WorkerResponse* WorkerResponse::New() const {
}
void WorkerResponse::Clear() {
id_ = 0;
if (_has_bits_[0 / 32] & 7) {
type_ = 1;
id_ = 0;
if (has_error_msg()) {
if (error_msg_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
error_msg_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->clear();
}
......@@ -1200,9 +1236,30 @@ bool WorkerResponse::MergePartialFromCodedStream(
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional int32 id = 2;
// required .loomcomm.WorkerResponse.Type type = 1;
case 1: {
if (tag == 8) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::loomcomm::WorkerResponse_Type_IsValid(value)) {
set_type(static_cast< ::loomcomm::WorkerResponse_Type >(value));
} else {
unknown_fields_stream.WriteVarint32(tag);
unknown_fields_stream.WriteVarint32(value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_id;
break;
}
// required int32 id = 2;
case 2: {
if (tag == 16) {
parse_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &id_)));
......@@ -1210,6 +1267,19 @@ bool WorkerResponse::MergePartialFromCodedStream(
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_error_msg;
break;
}
// optional string error_msg = 3;
case 3: {
if (tag == 26) {
parse_error_msg:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_error_msg()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
......@@ -1239,11 +1309,23 @@ failure:
void WorkerResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:loomcomm.WorkerResponse)
// optional int32 id = 2;
// required .loomcomm.WorkerResponse.Type type = 1;
if (has_type()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
1, this->type(), output);
}
// required int32 id = 2;
if (has_id()) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->id(), output);
}
// optional string error_msg = 3;
if (has_error_msg()) {
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->error_msg(), output);
}
output->WriteRaw(unknown_fields().data(),
unknown_fields().size());
// @@protoc_insertion_point(serialize_end:loomcomm.WorkerResponse)
......@@ -1253,13 +1335,26 @@ int WorkerResponse::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional int32 id = 2;
// required .loomcomm.WorkerResponse.Type type = 1;
if (has_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->type());
}
// required int32 id = 2;
if (has_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->id());
}
// optional string error_msg = 3;
if (has_error_msg()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->error_msg());
}
}
total_size += unknown_fields().size();
......@@ -1277,9 +1372,15 @@ void WorkerResponse::CheckTypeAndMergeFrom(
void WorkerResponse::MergeFrom(const WorkerResponse& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_type()) {
set_type(from.type());
}
if (from.has_id()) {
set_id(from.id());
}
if (from.has_error_msg()) {
set_error_msg(from.error_msg());
}
}
mutable_unknown_fields()->append(from.unknown_fields());
}
......@@ -1291,13 +1392,16 @@ void WorkerResponse::CopyFrom(const WorkerResponse& from) {
}
bool WorkerResponse::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void WorkerResponse::Swap(WorkerResponse* other) {
if (other != this) {
std::swap(type_, other->type_);
std::swap(id_, other->id_);
std::swap(error_msg_, other->error_msg_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.swap(other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
......@@ -2247,12 +2351,288 @@ void Info::Swap(Info* other) {
}
// ===================================================================
#ifndef _MSC_VER
const int Error::kIdFieldNumber;
const int Error::kWorkerFieldNumber;
const int Error::kErrorMsgFieldNumber;
#endif // !_MSC_VER
Error::Error()
: ::google::protobuf::MessageLite() {
SharedCtor();
// @@protoc_insertion_point(constructor:loomcomm.Error)
}
void Error::InitAsDefaultInstance() {
}
Error::Error(const Error& from)
: ::google::protobuf::MessageLite() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:loomcomm.Error)
}
void Error::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
id_ = 0;
worker_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
error_msg_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Error::~Error() {
// @@protoc_insertion_point(destructor:loomcomm.Error)
SharedDtor();
}
void Error::SharedDtor() {
if (worker_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete worker_;
}
if (error_msg_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete error_msg_;
}
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if (this != &default_instance()) {
#else
if (this != default_instance_) {
#endif
}
}
void Error::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const Error& Error::default_instance() {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_AddDesc_loomcomm_2eproto();
#else
if (default_instance_ == NULL) protobuf_AddDesc_loomcomm_2eproto();
#endif
return *default_instance_;
}
Error* Error::default_instance_ = NULL;
Error* Error::New() const {
return new Error;
}
void Error::Clear() {
if (_has_bits_[0 / 32] & 7) {
id_ = 0;
if (has_worker()) {
if (worker_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
worker_->clear();
}
}
if (has_error_msg()) {
if (error_msg_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
error_msg_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->clear();
}
bool Error::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
::google::protobuf::io::StringOutputStream unknown_fields_string(
mutable_unknown_fields());
::google::protobuf::io::CodedOutputStream unknown_fields_stream(
&unknown_fields_string);
// @@protoc_insertion_point(parse_start:loomcomm.Error)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag))