diff --git a/pip-dep/requirements.txt b/pip-dep/requirements.txt index de05f15f7ac..5bafbe1ee80 100644 --- a/pip-dep/requirements.txt +++ b/pip-dep/requirements.txt @@ -7,10 +7,10 @@ phe~=1.4.0 Pillow~=6.2.2 requests~=2.22.0 scipy~=1.4.1 -syft-proto~=0.2.3.a1 +syft-proto~=0.2.4.a1 tblib~=1.6.0 torchvision~=0.5.0 torch~=1.4.0 +tornado==4.5.3 websocket_client~=0.57.0 websockets~=8.1.0 -tornado==4.5.3 diff --git a/syft/generic/pointers/pointer_tensor.py b/syft/generic/pointers/pointer_tensor.py index 26711c6542c..4c80a8e43cc 100644 --- a/syft/generic/pointers/pointer_tensor.py +++ b/syft/generic/pointers/pointer_tensor.py @@ -11,7 +11,7 @@ from syft.generic.frameworks.types import FrameworkTensor from syft.generic.tensor import AbstractTensor from syft.generic.pointers.object_pointer import ObjectPointer -from syft.messaging.message import CommandMessage +from syft.messaging.message import TensorCommandMessage from syft.workers.abstract import AbstractWorker from syft_proto.generic.pointers.v1.pointer_tensor_pb2 import PointerTensor as PointerTensorPB @@ -263,7 +263,7 @@ def create_pointer( def move(self, destination): kwargs = {"inplace": True, "create_pointer": False} - message = CommandMessage.communication( + message = TensorCommandMessage.communication( self.id_at_location, self.location.id, [destination.id], kwargs ) self.owner.send_msg(message=message, location=self.location) @@ -279,7 +279,7 @@ def remote_send(self, destination): C will hold a pointer to a pointer on A which points to the tensor on B. """ kwargs = {"inplace": True} - message = CommandMessage.communication( + message = TensorCommandMessage.communication( self.id_at_location, self.location.id, [destination.id], kwargs ) self.owner.send_msg(message=message, location=self.location) diff --git a/syft/messaging/message.py b/syft/messaging/message.py index 8aba9993507..f07ca5d853a 100644 --- a/syft/messaging/message.py +++ b/syft/messaging/message.py @@ -21,7 +21,7 @@ from syft.frameworks.torch.tensors.interpreters.placeholder import PlaceHolder from syft_proto.messaging.v1.message_pb2 import ObjectMessage as ObjectMessagePB -from syft_proto.messaging.v1.message_pb2 import CommandMessage as CommandMessagePB +from syft_proto.messaging.v1.message_pb2 import TensorCommandMessage as CommandMessagePB class Message(ABC): @@ -52,7 +52,7 @@ def __repr__(self): return self.__str__() -class CommandMessage(Message): +class TensorCommandMessage(Message): """All syft actions use this message type In Syft, an action is when one worker wishes to tell another worker to do something with @@ -104,27 +104,27 @@ def __str__(self): @staticmethod def computation(name, target, args_, kwargs_, return_ids): - """ Helper function to build a CommandMessage containing a ComputationAction + """ Helper function to build a TensorCommandMessage containing a ComputationAction directly from the action arguments. """ action = ComputationAction(name, target, args_, kwargs_, return_ids) - return CommandMessage(action) + return TensorCommandMessage(action) @staticmethod def communication(obj_id, source, destinations, kwargs): - """ Helper function to build a CommandMessage containing a CommunicationAction + """ Helper function to build a TensorCommandMessage containing a CommunicationAction directly from the action arguments. """ action = CommunicationAction(obj_id, source, destinations, kwargs) - return CommandMessage(action) + return TensorCommandMessage(action) @staticmethod - def simplify(worker: AbstractWorker, ptr: "CommandMessage") -> tuple: + def simplify(worker: AbstractWorker, ptr: "TensorCommandMessage") -> tuple: """ - This function takes the attributes of a CommandMessage and saves them in a tuple + This function takes the attributes of a TensorCommandMessage and saves them in a tuple Args: worker (AbstractWorker): a reference to the worker doing the serialization - ptr (CommandMessage): a Message + ptr (TensorCommandMessage): a Message Returns: tuple: a tuple holding the unique attributes of the message Examples: @@ -133,17 +133,17 @@ def simplify(worker: AbstractWorker, ptr: "CommandMessage") -> tuple: return (sy.serde.msgpack.serde._simplify(worker, ptr.action),) @staticmethod - def detail(worker: AbstractWorker, msg_tuple: tuple) -> "CommandMessage": + def detail(worker: AbstractWorker, msg_tuple: tuple) -> "TensorCommandMessage": """ This function takes the simplified tuple version of this message and converts - it into a CommandMessage. The simplify() method runs the inverse of this method. + it into a TensorCommandMessage. The simplify() method runs the inverse of this method. Args: worker (AbstractWorker): a reference to the worker necessary for detailing. Read syft/serde/serde.py for more information on why this is necessary. msg_tuple (Tuple): the raw information being detailed. Returns: - ptr (CommandMessage): an CommandMessage. + ptr (TensorCommandMessage): an TensorCommandMessage. Examples: message = detail(sy.local_worker, msg_tuple) """ @@ -151,15 +151,17 @@ def detail(worker: AbstractWorker, msg_tuple: tuple) -> "CommandMessage": detailed_action = sy.serde.msgpack.serde._detail(worker, simplified_action) - return CommandMessage(detailed_action) + return TensorCommandMessage(detailed_action) @staticmethod - def bufferize(worker: AbstractWorker, action_message: "CommandMessage") -> "CommandMessagePB": + def bufferize( + worker: AbstractWorker, action_message: "TensorCommandMessage" + ) -> "CommandMessagePB": """ - This function takes the attributes of a CommandMessage and saves them in Protobuf + This function takes the attributes of a TensorCommandMessage and saves them in Protobuf Args: worker (AbstractWorker): a reference to the worker doing the serialization - action_message (CommandMessage): an CommandMessage + action_message (TensorCommandMessage): an TensorCommandMessage Returns: protobuf_obj: a Protobuf message holding the unique attributes of the message Examples: @@ -177,10 +179,12 @@ def bufferize(worker: AbstractWorker, action_message: "CommandMessage") -> "Comm return protobuf_action_msg @staticmethod - def unbufferize(worker: AbstractWorker, protobuf_obj: "CommandMessagePB") -> "CommandMessage": + def unbufferize( + worker: AbstractWorker, protobuf_obj: "CommandMessagePB" + ) -> "TensorCommandMessage": """ This function takes the Protobuf version of this message and converts - it into an CommandMessage. The bufferize() method runs the inverse of this method. + it into an TensorCommandMessage. The bufferize() method runs the inverse of this method. Args: worker (AbstractWorker): a reference to the worker necessary for detailing. Read @@ -188,14 +192,14 @@ def unbufferize(worker: AbstractWorker, protobuf_obj: "CommandMessagePB") -> "Co protobuf_obj (CommandMessagePB): the Protobuf message Returns: - obj (CommandMessage): an CommandMessage + obj (TensorCommandMessage): an TensorCommandMessage Examples: message = unbufferize(sy.local_worker, protobuf_msg) """ action = getattr(protobuf_obj, protobuf_obj.WhichOneof("action")) detailed_action = sy.serde.protobuf.serde._unbufferize(worker, action) - return CommandMessage(detailed_action) + return TensorCommandMessage(detailed_action) class ObjectMessage(Message): @@ -607,14 +611,14 @@ def detail(worker: AbstractWorker, msg_tuple: tuple) -> "PlanCommandMessage": ) -class ExecuteWorkerFunctionMessage(Message): +class WorkerCommandMessage(Message): """Message used to execute a function of the remote worker.""" # TODO: add more efficient detailer and simplifier custom for this type # https://github.com/OpenMined/PySyft/issues/2512 def __init__(self, command_name: str, message: tuple): - """Initialize a ExecuteWorkerFunctionMessage. + """Initialize a WorkerCommandMessage. Args: command_name (str): name used to identify the command. @@ -638,13 +642,13 @@ def contents(self): return (self.command_name, self.message) @staticmethod - def simplify(worker: AbstractWorker, ptr: "ExecuteWorkerFunctionMessage") -> tuple: + def simplify(worker: AbstractWorker, ptr: "WorkerCommandMessage") -> tuple: """ - This function takes the attributes of a ExecuteWorkerFunctionMessage and saves them in a tuple + This function takes the attributes of a WorkerCommandMessage and saves them in a tuple Args: worker (AbstractWorker): a reference to the worker doing the serialization - ptr (ExecuteWorkerFunctionMessage): a Message + ptr (WorkerCommandMessage): a Message Returns: tuple: a tuple holding the unique attributes of the message @@ -655,20 +659,20 @@ def simplify(worker: AbstractWorker, ptr: "ExecuteWorkerFunctionMessage") -> tup ) @staticmethod - def detail(worker: AbstractWorker, msg_tuple: tuple) -> "ExecuteWorkerFunctionMessage": + def detail(worker: AbstractWorker, msg_tuple: tuple) -> "WorkerCommandMessage": """ This function takes the simplified tuple version of this message and converts - it into a ExecuteWorkerFunctionMessage. The simplify() method runs the inverse of this method. + it into a WorkerCommandMessage. The simplify() method runs the inverse of this method. Args: worker (AbstractWorker): a reference to the worker necessary for detailing. Read syft/serde/serde.py for more information on why this is necessary. msg_tuple (Tuple): the raw information being detailed. Returns: - ptr (ExecuteWorkerFunctionMessage): a ExecuteWorkerFunctionMessage. + ptr (WorkerCommandMessage): a WorkerCommandMessage. """ command_name, message = msg_tuple - return ExecuteWorkerFunctionMessage( + return WorkerCommandMessage( sy.serde.msgpack.serde._detail(worker, command_name), sy.serde.msgpack.serde._detail(worker, message), ) diff --git a/syft/serde/msgpack/serde.py b/syft/serde/msgpack/serde.py index 3d31bf73c8c..ab73f2ce9cc 100644 --- a/syft/serde/msgpack/serde.py +++ b/syft/serde/msgpack/serde.py @@ -59,7 +59,7 @@ from syft.execution.computation import ComputationAction from syft.execution.communication import CommunicationAction from syft.execution.protocol import Protocol -from syft.messaging.message import CommandMessage +from syft.messaging.message import TensorCommandMessage from syft.messaging.message import ObjectMessage from syft.messaging.message import ObjectRequestMessage from syft.messaging.message import IsNoneMessage @@ -67,7 +67,7 @@ from syft.messaging.message import ForceObjectDeleteMessage from syft.messaging.message import SearchMessage from syft.messaging.message import PlanCommandMessage -from syft.messaging.message import ExecuteWorkerFunctionMessage +from syft.messaging.message import WorkerCommandMessage from syft.serde import compression from syft.serde.msgpack.native_serde import MAP_NATIVE_SIMPLIFIERS_AND_DETAILERS from syft.workers.abstract import AbstractWorker @@ -124,7 +124,7 @@ TrainConfig, BaseWorker, AutogradTensor, - CommandMessage, + TensorCommandMessage, ObjectMessage, ObjectRequestMessage, IsNoneMessage, @@ -132,10 +132,10 @@ ForceObjectDeleteMessage, SearchMessage, PlanCommandMessage, + WorkerCommandMessage, GradFunc, String, BaseDataset, - ExecuteWorkerFunctionMessage, ] # If an object implements its own force_simplify and force_detail functions it should be stored in this list diff --git a/syft/serde/protobuf/proto.py b/syft/serde/protobuf/proto.py index 88f8fd5d3ff..7c021201a39 100644 --- a/syft/serde/protobuf/proto.py +++ b/syft/serde/protobuf/proto.py @@ -16,7 +16,7 @@ from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor from syft.frameworks.torch.tensors.interpreters.placeholder import PlaceHolder from syft.generic.pointers.pointer_tensor import PointerTensor -from syft.messaging.message import CommandMessage +from syft.messaging.message import TensorCommandMessage from syft.messaging.message import ObjectMessage from google.protobuf.empty_pb2 import Empty @@ -35,7 +35,7 @@ ) from syft_proto.generic.pointers.v1.pointer_tensor_pb2 import PointerTensor as PointerTensorPB from syft_proto.messaging.v1.message_pb2 import ObjectMessage as ObjectMessagePB -from syft_proto.messaging.v1.message_pb2 import CommandMessage as CommandMessagePB +from syft_proto.messaging.v1.message_pb2 import TensorCommandMessage as CommandMessagePB from syft_proto.types.syft.v1.id_pb2 import Id as IdPB from syft_proto.types.torch.v1.device_pb2 import Device as DevicePB from syft_proto.types.torch.v1.parameter_pb2 import Parameter as ParameterPB @@ -59,7 +59,7 @@ # Syft types AdditiveSharingTensor: AdditiveSharingTensorPB, ObjectMessage: ObjectMessagePB, - CommandMessage: CommandMessagePB, + TensorCommandMessage: CommandMessagePB, CommunicationAction: CommunicationActionPB, ComputationAction: ComputationActionPB, PlaceHolder: PlaceholderPB, diff --git a/syft/serde/protobuf/serde.py b/syft/serde/protobuf/serde.py index 364f97bd8f5..b4a5056ebde 100644 --- a/syft/serde/protobuf/serde.py +++ b/syft/serde/protobuf/serde.py @@ -9,7 +9,7 @@ from syft.frameworks.torch.tensors.interpreters.placeholder import PlaceHolder from syft.generic.pointers.pointer_tensor import PointerTensor from syft.messaging.message import ObjectMessage -from syft.messaging.message import CommandMessage +from syft.messaging.message import TensorCommandMessage from syft.execution.plan import Plan from syft.execution.protocol import Protocol from syft.execution.state import State @@ -44,7 +44,7 @@ AdditiveSharingTensor, ObjectMessage, ComputationAction, - CommandMessage, + TensorCommandMessage, CommunicationAction, PlaceHolder, Plan, @@ -241,7 +241,7 @@ def serialize( msg_wrapper.contents_empty_msg.CopyFrom(protobuf_obj) elif obj_type == ObjectMessage: msg_wrapper.contents_object_msg.CopyFrom(protobuf_obj) - elif obj_type == CommandMessage: + elif obj_type == TensorCommandMessage: msg_wrapper.contents_action_msg.CopyFrom(protobuf_obj) # 2) Serialize diff --git a/syft/workers/base.py b/syft/workers/base.py index 0dab01efae3..2637ba1be48 100644 --- a/syft/workers/base.py +++ b/syft/workers/base.py @@ -23,8 +23,8 @@ from syft.generic.tensor import AbstractTensor from syft.generic.pointers.object_pointer import ObjectPointer from syft.generic.pointers.pointer_tensor import PointerTensor -from syft.messaging.message import CommandMessage -from syft.messaging.message import ExecuteWorkerFunctionMessage +from syft.messaging.message import TensorCommandMessage +from syft.messaging.message import WorkerCommandMessage from syft.messaging.message import ForceObjectDeleteMessage from syft.messaging.message import GetShapeMessage from syft.messaging.message import IsNoneMessage @@ -118,8 +118,9 @@ def __init__( # For performance, we cache all possible message types self._message_router = { - CommandMessage: self.execute_command, + TensorCommandMessage: self.execute_tensor_command, PlanCommandMessage: self.execute_plan_command, + WorkerCommandMessage: self.execute_worker_command, ObjectMessage: self.handle_object_msg, ObjectRequestMessage: self.respond_to_obj_req, ForceObjectDeleteMessage: self.handle_delete_object_msg, # FIXME: there is no ObjectDeleteMessage @@ -127,7 +128,6 @@ def __init__( IsNoneMessage: self.is_object_none, GetShapeMessage: self.handle_get_shape_message, SearchMessage: self.respond_to_search, - ExecuteWorkerFunctionMessage: self.execute_worker_function, } self._plan_command_router = { @@ -171,7 +171,7 @@ def __init__( self.framework = None else: # TODO[jvmancuso]: avoid branching here if possible, maybe by changing code in - # execute_command or command_guard to not expect an attribute named "torch" + # execute_tensor_command or command_guard to not expect an attribute named "torch" # (#2530) self.framework = hook.framework if hasattr(hook, "torch"): @@ -429,13 +429,13 @@ def handle_delete_object_msg(self, msg: ForceObjectDeleteMessage): def handle_force_delete_object_msg(self, msg: ForceObjectDeleteMessage): self.force_rm_obj(msg.object_id) - def execute_command(self, cmd: CommandMessage) -> PointerTensor: + def execute_tensor_command(self, cmd: TensorCommandMessage) -> PointerTensor: if isinstance(cmd.action, ComputationAction): - return self.execute_computation(cmd.action) + return self.execute_computation_action(cmd.action) else: - return self.execute_communication(cmd.action) + return self.execute_communication_action(cmd.action) - def execute_computation(self, action: ComputationAction) -> PointerTensor: + def execute_computation_action(self, action: ComputationAction) -> PointerTensor: """ Executes commands received from other workers. Args: @@ -502,7 +502,7 @@ def execute_computation(self, action: ComputationAction) -> PointerTensor: new_ids = return_id_provider.get_recorded_ids() raise ResponseSignatureError(new_ids) - def execute_communication(self, action: CommunicationAction) -> PointerTensor: + def execute_communication_action(self, action: CommunicationAction) -> PointerTensor: obj_id = action.obj_id source = action.source destinations = action.destinations @@ -519,7 +519,7 @@ def execute_communication(self, action: CommunicationAction) -> PointerTensor: self.rm_obj(obj_id) return response - def execute_worker_function(self, message: tuple): + def execute_worker_command(self, message: tuple): """Executes commands received from other workers. Args: @@ -579,7 +579,7 @@ def send_command( name, target, args_, kwargs_ = message try: - message = CommandMessage.computation(name, target, args_, kwargs_, return_ids) + message = TensorCommandMessage.computation(name, target, args_, kwargs_, return_ids) ret_val = self.send_msg(message, location=recipient) except ResponseSignatureError as e: ret_val = None @@ -1110,24 +1110,22 @@ def message_pending_time(self, seconds: Union[int, float]) -> None: self._message_pending_time = seconds @staticmethod - def create_execute_worker_function_message(command_name: str, return_ids=None, *args, **kwargs): - """helper function creating a message tuple for the execute_command call + def create_worker_command_message(command_name: str, return_ids=None, *args, **kwargs): + """helper function creating a worker command message Args: command_name: name of the command that shall be called - command_owner: owner of the function (None for torch functions, "self" for classes derived from - workers.base or ptr_id for remote objects return_ids: optionally set the ids of the return values (for remote objects) *args: will be passed to the call of command_name **kwargs: will be passed to the call of command_name Returns: - tuple: (command_name, command_owner, args, kwargs), return_ids + cmd_msg: a WorkerCommandMessage """ if return_ids is None: return_ids = [] - return ExecuteWorkerFunctionMessage(command_name, (args, kwargs, return_ids)) + return WorkerCommandMessage(command_name, (args, kwargs, return_ids)) @property def serializer(self, workers=None) -> codes.TENSOR_SERIALIZATION: diff --git a/syft/workers/websocket_client.py b/syft/workers/websocket_client.py index 92dbb6cf8c7..d77cb35bf45 100644 --- a/syft/workers/websocket_client.py +++ b/syft/workers/websocket_client.py @@ -107,9 +107,7 @@ def _recv_msg(self, message: bin) -> bin: return response def _send_msg_and_deserialize(self, command_name: str, *args, **kwargs): - message = self.create_execute_worker_function_message( - command_name=command_name, *args, **kwargs - ) + message = self.create_worker_command_message(command_name=command_name, *args, **kwargs) # Send the message and return the deserialized response. serialized_message = sy.serde.serialize(message) @@ -150,7 +148,7 @@ async def async_fit(self, dataset_key: str, return_ids: List[int] = None): async with websockets.connect( self.url, timeout=TIMEOUT_INTERVAL, max_size=None, ping_timeout=TIMEOUT_INTERVAL ) as websocket: - message = self.create_execute_worker_function_message( + message = self.create_worker_command_message( command_name="fit", return_ids=return_ids, dataset_key=dataset_key ) diff --git a/test/message/test_message.py b/test/message/test_message.py index 800f3c00fd3..41c22d8e5db 100644 --- a/test/message/test_message.py +++ b/test/message/test_message.py @@ -14,7 +14,7 @@ def test_cmd_message(workers): x = th.tensor([1, 2, 3, 4]).send(bob) y = x + x # this is the test - assert isinstance(bob._get_msg(-1), message.CommandMessage) + assert isinstance(bob._get_msg(-1), message.TensorCommandMessage) y = y.get() diff --git a/test/serde/msgpack/test_msgpack_serde_full.py b/test/serde/msgpack/test_msgpack_serde_full.py index e9a16b68cd6..6182a2983fe 100644 --- a/test/serde/msgpack/test_msgpack_serde_full.py +++ b/test/serde/msgpack/test_msgpack_serde_full.py @@ -73,7 +73,7 @@ samples[syft.frameworks.torch.tensors.interpreters.placeholder.PlaceHolder] = make_placeholder samples[syft.frameworks.torch.fl.dataset.BaseDataset] = make_basedataset -samples[syft.messaging.message.CommandMessage] = make_command_message +samples[syft.messaging.message.TensorCommandMessage] = make_command_message samples[syft.messaging.message.ObjectMessage] = make_objectmessage samples[syft.messaging.message.ObjectRequestMessage] = make_objectrequestmessage samples[syft.messaging.message.IsNoneMessage] = make_isnonemessage @@ -81,7 +81,7 @@ samples[syft.messaging.message.ForceObjectDeleteMessage] = make_forceobjectdeletemessage samples[syft.messaging.message.SearchMessage] = make_searchmessage samples[syft.messaging.message.PlanCommandMessage] = make_plancommandmessage -samples[syft.messaging.message.ExecuteWorkerFunctionMessage] = make_executeworkerfunctionmessage +samples[syft.messaging.message.WorkerCommandMessage] = make_workercommandmessage samples[syft.frameworks.torch.tensors.interpreters.gradients_core.GradFunc] = make_gradfn diff --git a/test/serde/protobuf/test_protobuf_serde_full.py b/test/serde/protobuf/test_protobuf_serde_full.py index d007cf3ee61..7e4b3ee103e 100644 --- a/test/serde/protobuf/test_protobuf_serde_full.py +++ b/test/serde/protobuf/test_protobuf_serde_full.py @@ -39,7 +39,7 @@ # Syft Messages samples[syft.messaging.message.ObjectMessage] = make_objectmessage -samples[syft.messaging.message.CommandMessage] = make_command_message +samples[syft.messaging.message.TensorCommandMessage] = make_command_message def test_serde_coverage(): diff --git a/test/serde/serde_helpers.py b/test/serde/serde_helpers.py index c70332c1459..d41826ac544 100644 --- a/test/serde/serde_helpers.py +++ b/test/serde/serde_helpers.py @@ -1420,7 +1420,7 @@ def compare(detailed, original): ] -# syft.messaging.message.CommandMessage +# syft.messaging.message.TensorCommandMessage def make_command_message(**kwargs): bob = kwargs["workers"]["bob"] alice = kwargs["workers"]["alice"] @@ -1463,7 +1463,7 @@ def compare(detailed, original): { "value": cmd1, "simplified": ( - CODE[syft.messaging.message.CommandMessage], + CODE[syft.messaging.message.TensorCommandMessage], (msgpack.serde._simplify(syft.hook.local_worker, cmd1.action),), # (Any) message ), "cmp_detailed": compare, @@ -1471,7 +1471,7 @@ def compare(detailed, original): { "value": cmd2, "simplified": ( - CODE[syft.messaging.message.CommandMessage], + CODE[syft.messaging.message.TensorCommandMessage], (msgpack.serde._simplify(syft.hook.local_worker, cmd2.action),), # (Any) message ), "cmp_detailed": compare, @@ -1479,7 +1479,7 @@ def compare(detailed, original): { "value": cmd3, "simplified": ( - CODE[syft.messaging.message.CommandMessage], + CODE[syft.messaging.message.TensorCommandMessage], (msgpack.serde._simplify(syft.hook.local_worker, cmd3.action),), ), "cmp_detailed": compare, @@ -1694,8 +1694,8 @@ def compare(detailed, original): ] -# ExecuteWorkerFunctionMessage -def make_executeworkerfunctionmessage(**kwargs): +# WorkerCommandMessage +def make_workercommandmessage(**kwargs): server, remote_proxy = kwargs["start_remote_worker"]( id=kwargs["id"], hook=kwargs["hook"], port=kwargs["port"] ) @@ -1712,7 +1712,7 @@ def make_executeworkerfunctionmessage(**kwargs): server.terminate() def compare(detailed, original): - assert type(detailed) == syft.messaging.message.ExecuteWorkerFunctionMessage + assert type(detailed) == syft.messaging.message.WorkerCommandMessage assert detailed.contents == original.contents return True @@ -1720,7 +1720,7 @@ def compare(detailed, original): { "value": objects_count_msg, "simplified": ( - CODE[syft.messaging.message.ExecuteWorkerFunctionMessage], + CODE[syft.messaging.message.WorkerCommandMessage], ( (CODE[str], (b"objects_count",)), # (str) command (CODE[tuple], ((CODE[tuple], ()), (CODE[dict], ()), (CODE[list], ()))), diff --git a/test/workers/test_base.py b/test/workers/test_base.py index 8e37e6a316a..8d33e0f33da 100644 --- a/test/workers/test_base.py +++ b/test/workers/test_base.py @@ -76,7 +76,7 @@ def test_execute_worker_function(hook): bob = sy.VirtualWorker(hook, "bob") x = th.tensor([1, 2, 3]).send(bob) - message = bob.create_execute_worker_function_message( + message = bob.create_worker_command_message( command_name="mocked_function", command_owner="self" )