Skip to content

Add message pending time option to virtual workers#3070

Merged
karlhigley merged 8 commits intoOpenMined:masterfrom
jefersonf:msg_pending_time
Feb 23, 2020
Merged

Add message pending time option to virtual workers#3070
karlhigley merged 8 commits intoOpenMined:masterfrom
jefersonf:msg_pending_time

Conversation

@jefersonf
Copy link
Member

As mentioned in #3007. It would be useful simulate latency while sending messages between workers. So I add an option to set a message_pending_time in the creation of a VirtualWorker.

You can see an example of usage below or in the test_send_msg.

...
alice = syft.VirtualWorker(
    hook=torchHook, id="alice", message_pending_time=1.5, verbose=True
)
bob = syft.VirtualWorker(hook=torchHook, id="bob")

obj = torch.Tensor([1, 2, 3])

# In this example, 2 messages will be sent and each one will take 1.5 seconds
alice.send(obj, bob)

Logs Output:

worker <VirtualWorker id:alice #objects:0> sending (ObjectMessage tensor([1, 2, 3])) to <VirtualWorker id:bob #objects:5>
pending time of 1.5 seconds to send message...
worker <VirtualWorker id:alice #objects:0> sending (ForceObjectDeleteMessage 4444064520) to <VirtualWorker id:bob #objects:6>
pending time of 1.5 seconds to send message...
[PointerTensor | alice:9312967354 -> bob:36492502540]

Resolves: #3007

@jefersonf jefersonf requested review from joaolcaas and marcusvlc and removed request for joaolcaas and marcusvlc February 19, 2020 17:45
@karlhigley karlhigley added the Type: New Feature ➕ Introduction of a completely new addition to the codebase label Feb 19, 2020
@karlhigley karlhigley merged commit 370568b into OpenMined:master Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: New Feature ➕ Introduction of a completely new addition to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add latency simulation to Virtual workers

2 participants