-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathasync_command.py
39 lines (30 loc) · 1.13 KB
/
async_command.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from sentio_prober_control.Sentio.ProberSentio import *
from sentio_prober_control.Communication.CommunicatorGpib import *
from sentio_prober_control.Communication.CommunicatorTcpIp import *
def main() -> None:
prober = SentioProber.create_prober("tcpip", "127.0.0.1:35555")
prober.initialize_if_needed()
# Use Sentios mechanism for sending remote commands directly
# Start first command
resp: Response = prober.send_cmd("start_async_cmd")
cmd_id1: int = resp.cmd_id()
# Start second command
resp = prober.send_cmd("start_async_cmd")
cmd_id2 = resp.cmd_id()
#
# Her you can do other stuff whilst the commands are executing
#
# Method 1:
# Wait for all commands to finish
prober.wait_all(180)
# alternatively wait for each of the commands:
#prober.wait_complete(cmd_id1, 60)
#prober.wait_complete(cmd_id2, 60)
# Second way use query_command_status for polling:
#while True:
# time.sleep(1)
# resp = prober.query_command_status(cmd_id)
# if (resp.errc()!=RemoteCommandError.CommandPending):
# break;
if __name__ == "__main__":
main()