EventService timed out after:3000 - hyperledger-fabric

I'm invoking my chaincode via node-sdk by queueing the submissions via the async package. However, I very often get a error: [EventService]: EventService[org1-peer1] timed out after:3000. There's no additional information at the peer's log. The transaction is getting processed, though.
Here's the client log (GRPC_VERBOSITY=DEBUG, GRPC_TRACE=all):
--> Starting task
2020-08-13T08:49:36.081Z | call_stream | [2] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.083Z | call_stream | [2] receive HTTP/2 data frame of length 1476
2020-08-13T08:49:36.083Z | call_stream | [2] parsed message of length 1476
2020-08-13T08:49:36.084Z | call_stream | [2] filterReceivedMessage of length 1476
2020-08-13T08:49:36.084Z | call_stream | [2] pushing to reader message of length 1471
2020-08-13T08:49:36.088Z | call_stream | [2] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.088Z | call_stream | [2] received status code 0 from server
2020-08-13T08:49:36.088Z | call_stream | [2] received status details string "" from server
2020-08-13T08:49:36.089Z | call_stream | [2] ended with status: code=0 details=""
2020-08-13T08:49:36.090Z | subchannel | 10.100.136.32:30171 callRefcount 3 -> 2
2020-08-13T08:49:36.090Z | call_stream | [2] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.098Z | call_stream | [8] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.099Z | call_stream | [8] receive HTTP/2 data frame of length 1476
2020-08-13T08:49:36.099Z | call_stream | [8] parsed message of length 1476
2020-08-13T08:49:36.099Z | call_stream | [8] filterReceivedMessage of length 1476
2020-08-13T08:49:36.099Z | call_stream | [8] pushing to reader message of length 1471
2020-08-13T08:49:36.100Z | call_stream | [8] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.100Z | call_stream | [8] received status code 0 from server
2020-08-13T08:49:36.100Z | call_stream | [8] received status details string "" from server
2020-08-13T08:49:36.100Z | call_stream | [8] ended with status: code=0 details=""
2020-08-13T08:49:36.101Z | subchannel | 10.100.136.32:30171 callRefcount 2 -> 1
2020-08-13T08:49:36.101Z | call_stream | [8] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.101Z | call_stream | [5] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.101Z | call_stream | [5] receive HTTP/2 data frame of length 1476
2020-08-13T08:49:36.101Z | call_stream | [5] parsed message of length 1476
2020-08-13T08:49:36.101Z | call_stream | [5] filterReceivedMessage of length 1476
2020-08-13T08:49:36.102Z | call_stream | [5] pushing to reader message of length 1471
2020-08-13T08:49:36.102Z | call_stream | [5] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.102Z | call_stream | [5] received status code 0 from server
2020-08-13T08:49:36.102Z | call_stream | [5] received status details string "" from server
2020-08-13T08:49:36.102Z | call_stream | [5] ended with status: code=0 details=""
2020-08-13T08:49:36.102Z | subchannel | 10.100.136.32:30171 callRefcount 1 -> 0
2020-08-13T08:49:36.102Z | call_stream | [5] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.103Z | call_stream | [6] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.103Z | call_stream | [6] receive HTTP/2 data frame of length 1476
2020-08-13T08:49:36.103Z | call_stream | [6] parsed message of length 1476
2020-08-13T08:49:36.103Z | call_stream | [6] filterReceivedMessage of length 1476
2020-08-13T08:49:36.103Z | call_stream | [6] pushing to reader message of length 1471
2020-08-13T08:49:36.103Z | call_stream | [6] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.103Z | call_stream | [6] received status code 0 from server
2020-08-13T08:49:36.103Z | call_stream | [6] received status details string "" from server
2020-08-13T08:49:36.103Z | call_stream | [6] ended with status: code=0 details=""
2020-08-13T08:49:36.104Z | subchannel | 10.100.136.32:30151 callRefcount 3 -> 2
2020-08-13T08:49:36.104Z | call_stream | [6] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.104Z | call_stream | [0] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.104Z | call_stream | [0] receive HTTP/2 data frame of length 1477
2020-08-13T08:49:36.104Z | call_stream | [0] parsed message of length 1477
2020-08-13T08:49:36.104Z | call_stream | [0] filterReceivedMessage of length 1477
2020-08-13T08:49:36.104Z | call_stream | [0] pushing to reader message of length 1472
2020-08-13T08:49:36.104Z | call_stream | [0] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.104Z | call_stream | [0] received status code 0 from server
2020-08-13T08:49:36.104Z | call_stream | [0] received status details string "" from server
2020-08-13T08:49:36.105Z | call_stream | [0] ended with status: code=0 details=""
2020-08-13T08:49:36.105Z | subchannel | 10.100.136.32:30151 callRefcount 2 -> 1
2020-08-13T08:49:36.105Z | call_stream | [0] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.105Z | call_stream | [3] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.105Z | call_stream | [3] receive HTTP/2 data frame of length 1476
2020-08-13T08:49:36.105Z | call_stream | [3] parsed message of length 1476
2020-08-13T08:49:36.105Z | call_stream | [3] filterReceivedMessage of length 1476
2020-08-13T08:49:36.106Z | call_stream | [3] pushing to reader message of length 1471
2020-08-13T08:49:36.106Z | call_stream | [3] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.106Z | call_stream | [3] received status code 0 from server
2020-08-13T08:49:36.106Z | call_stream | [3] received status details string "" from server
2020-08-13T08:49:36.106Z | call_stream | [3] ended with status: code=0 details=""
2020-08-13T08:49:36.106Z | subchannel | 10.100.136.32:30151 callRefcount 1 -> 0
2020-08-13T08:49:36.106Z | call_stream | [3] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.107Z | call_stream | [7] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.107Z | call_stream | [7] receive HTTP/2 data frame of length 1477
2020-08-13T08:49:36.107Z | call_stream | [7] parsed message of length 1477
2020-08-13T08:49:36.107Z | call_stream | [7] filterReceivedMessage of length 1477
2020-08-13T08:49:36.107Z | call_stream | [7] pushing to reader message of length 1472
2020-08-13T08:49:36.107Z | call_stream | [7] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.107Z | call_stream | [7] received status code 0 from server
2020-08-13T08:49:36.107Z | call_stream | [7] received status details string "" from server
2020-08-13T08:49:36.108Z | call_stream | [7] ended with status: code=0 details=""
2020-08-13T08:49:36.108Z | subchannel | 10.100.136.32:30161 callRefcount 3 -> 2
2020-08-13T08:49:36.108Z | call_stream | [7] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.116Z | resolving_load_balancer | dns:worker2.example.com:30151 IDLE -> IDLE
2020-08-13T08:49:36.116Z | connectivity_state | dns:worker2.example.com:30151 IDLE -> IDLE
2020-08-13T08:49:36.116Z | dns_resolver | Resolver constructed for target dns:worker2.example.com:30151
2020-08-13T08:49:36.117Z | call_stream | [1] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.117Z | call_stream | [1] receive HTTP/2 data frame of length 1477
2020-08-13T08:49:36.117Z | call_stream | [1] parsed message of length 1477
2020-08-13T08:49:36.117Z | call_stream | [1] filterReceivedMessage of length 1477
2020-08-13T08:49:36.117Z | call_stream | [1] pushing to reader message of length 1472
2020-08-13T08:49:36.117Z | call_stream | [1] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.117Z | call_stream | [1] received status code 0 from server
2020-08-13T08:49:36.118Z | call_stream | [1] received status details string "" from server
2020-08-13T08:49:36.118Z | call_stream | [1] ended with status: code=0 details=""
2020-08-13T08:49:36.118Z | subchannel | 10.100.136.32:30161 callRefcount 2 -> 1
2020-08-13T08:49:36.118Z | call_stream | [1] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.122Z | dns_resolver | Resolution update requested for target dns:worker2.example.com:30151
2020-08-13T08:49:36.122Z | resolving_load_balancer | dns:worker2.example.com:30151 IDLE -> CONNECTING
2020-08-13T08:49:36.122Z | connectivity_state | dns:worker2.example.com:30151 IDLE -> CONNECTING
2020-08-13T08:49:36.122Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.122Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.132Z | dns_resolver | Resolved addresses for target dns:worker2.example.com:30151: [10.100.136.32:30151]
2020-08-13T08:49:36.132Z | pick_first | IDLE -> IDLE
2020-08-13T08:49:36.132Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> IDLE
2020-08-13T08:49:36.132Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> IDLE
2020-08-13T08:49:36.132Z | dns_resolver | Resolution update requested for target dns:worker2.example.com:30151
2020-08-13T08:49:36.132Z | resolving_load_balancer | dns:worker2.example.com:30151 IDLE -> CONNECTING
2020-08-13T08:49:36.132Z | connectivity_state | dns:worker2.example.com:30151 IDLE -> CONNECTING
2020-08-13T08:49:36.133Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.133Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.133Z | pick_first | Connect to address list 10.100.136.32:30151
2020-08-13T08:49:36.134Z | subchannel | 10.100.136.32:30151 refcount 0 -> 1
2020-08-13T08:49:36.135Z | subchannel | 10.100.136.32:30151 refcount 1 -> 2
2020-08-13T08:49:36.135Z | pick_first | Start connecting to subchannel with address 10.100.136.32:30151
2020-08-13T08:49:36.135Z | pick_first | IDLE -> CONNECTING
2020-08-13T08:49:36.135Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.135Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.135Z | subchannel | 10.100.136.32:30151 IDLE -> CONNECTING
2020-08-13T08:49:36.135Z | pick_first | CONNECTING -> CONNECTING
2020-08-13T08:49:36.135Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.135Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.136Z | call_stream | [4] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.136Z | call_stream | [4] receive HTTP/2 data frame of length 1477
2020-08-13T08:49:36.136Z | call_stream | [4] parsed message of length 1477
2020-08-13T08:49:36.137Z | call_stream | [4] filterReceivedMessage of length 1477
2020-08-13T08:49:36.137Z | call_stream | [4] pushing to reader message of length 1472
2020-08-13T08:49:36.137Z | call_stream | [4] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.137Z | call_stream | [4] received status code 0 from server
2020-08-13T08:49:36.137Z | call_stream | [4] received status details string "" from server
2020-08-13T08:49:36.137Z | call_stream | [4] ended with status: code=0 details=""
2020-08-13T08:49:36.137Z | subchannel | 10.100.136.32:30161 callRefcount 1 -> 0
2020-08-13T08:49:36.137Z | call_stream | [4] HTTP/2 stream closed with code 0
2020-08-13T08:49:36.142Z | dns_resolver | Resolved addresses for target dns:worker2.example.com:30151: [10.100.136.32:30151]
2020-08-13T08:49:36.142Z | subchannel | 10.100.136.32:30151 refcount 2 -> 1
2020-08-13T08:49:36.142Z | pick_first | Connect to address list 10.100.136.32:30151
2020-08-13T08:49:36.142Z | subchannel | 10.100.136.32:30151 refcount 1 -> 2
2020-08-13T08:49:36.142Z | pick_first | CONNECTING -> CONNECTING
2020-08-13T08:49:36.143Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.143Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> CONNECTING
2020-08-13T08:49:36.237Z | subchannel | 10.100.136.32:30151 CONNECTING -> READY
2020-08-13T08:49:36.237Z | pick_first | Pick subchannel with address 10.100.136.32:30151
2020-08-13T08:49:36.237Z | pick_first | CONNECTING -> READY
2020-08-13T08:49:36.237Z | resolving_load_balancer | dns:worker2.example.com:30151 CONNECTING -> READY
2020-08-13T08:49:36.237Z | connectivity_state | dns:worker2.example.com:30151 CONNECTING -> READY
2020-08-13T08:49:36.237Z | subchannel | 10.100.136.32:30151 refcount 2 -> 3
2020-08-13T08:49:36.237Z | subchannel | 10.100.136.32:30151 refcount 3 -> 2
2020-08-13T08:49:36.239Z | channel | dns:worker2.example.com:30151 createCall [9] method="/protos.Deliver/DeliverFiltered", deadline=Infinity
2020-08-13T08:49:36.239Z | call_stream | [9] Sending metadata
2020-08-13T08:49:36.239Z | channel | Pick result: COMPLETE subchannel: 10.100.136.32:30151 status: undefined undefined
2020-08-13T08:49:36.240Z | call_stream | [9] write() called with message of length 1111
2020-08-13T08:49:36.241Z | channel | dns:worker2.example.com:30151 createCall [10] method="/protos.Deliver/DeliverFiltered", deadline=Infinity
2020-08-13T08:49:36.241Z | call_stream | [10] Sending metadata
2020-08-13T08:49:36.241Z | channel | Pick result: COMPLETE subchannel: 10.100.136.32:30151 status: undefined undefined
2020-08-13T08:49:36.241Z | call_stream | [10] write() called with message of length 1110
2020-08-13T08:49:36.241Z | call_stream | [9] deferring writing data chunk of length 1116
2020-08-13T08:49:36.241Z | call_stream | [10] deferring writing data chunk of length 1115
2020-08-13T08:49:36.241Z | subchannel | Starting stream with headers
grpc-accept-encoding: identity,deflate,gzip
accept-encoding: identity,gzip
:authority: worker2.example.com
user-agent: grpc-node-js/1.0.3
content-type: application/grpc
:method: POST
:path: /protos.Deliver/DeliverFiltered
te: trailers
2020-08-13T08:49:36.241Z | call_stream | [9] attachHttp2Stream from subchannel 10.100.136.32:30151
2020-08-13T08:49:36.241Z | subchannel | 10.100.136.32:30151 callRefcount 0 -> 1
2020-08-13T08:49:36.241Z | call_stream | [9] sending data chunk of length 1116 (deferred)
2020-08-13T08:49:36.242Z | subchannel | Starting stream with headers
grpc-accept-encoding: identity,deflate,gzip
accept-encoding: identity,gzip
:authority: worker2.example.com
user-agent: grpc-node-js/1.0.3
content-type: application/grpc
:method: POST
:path: /protos.Deliver/DeliverFiltered
te: trailers
2020-08-13T08:49:36.242Z | call_stream | [10] attachHttp2Stream from subchannel 10.100.136.32:30151
2020-08-13T08:49:36.242Z | subchannel | 10.100.136.32:30151 callRefcount 1 -> 2
2020-08-13T08:49:36.242Z | call_stream | [10] sending data chunk of length 1115 (deferred)
2020-08-13T08:49:36.242Z | channel | dns:worker2.example.com:30151 createCall [11] method="/protos.Deliver/DeliverFiltered", deadline=Infinity
2020-08-13T08:49:36.243Z | call_stream | [11] Sending metadata
2020-08-13T08:49:36.243Z | channel | Pick result: COMPLETE subchannel: 10.100.136.32:30151 status: undefined undefined
2020-08-13T08:49:36.243Z | call_stream | [11] write() called with message of length 1111
2020-08-13T08:49:36.243Z | call_stream | [11] deferring writing data chunk of length 1116
2020-08-13T08:49:36.243Z | subchannel | Starting stream with headers
grpc-accept-encoding: identity,deflate,gzip
accept-encoding: identity,gzip
:authority: worker2.example.com
user-agent: grpc-node-js/1.0.3
content-type: application/grpc
:method: POST
:path: /protos.Deliver/DeliverFiltered
te: trailers
2020-08-13T08:49:36.243Z | call_stream | [11] attachHttp2Stream from subchannel 10.100.136.32:30151
2020-08-13T08:49:36.243Z | subchannel | 10.100.136.32:30151 callRefcount 2 -> 3
2020-08-13T08:49:36.243Z | call_stream | [11] sending data chunk of length 1116 (deferred)
2020-08-13T08:49:36.273Z | call_stream | [9] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.273Z | call_stream | [9] receive HTTP/2 data frame of length 164
2020-08-13T08:49:36.274Z | call_stream | [9] parsed message of length 164
2020-08-13T08:49:36.274Z | call_stream | [9] filterReceivedMessage of length 164
2020-08-13T08:49:36.274Z | call_stream | [9] pushing to reader message of length 159
2020-08-13T08:49:36.279Z | call_stream | [11] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.279Z | call_stream | [11] receive HTTP/2 data frame of length 164
2020-08-13T08:49:36.279Z | call_stream | [11] parsed message of length 164
2020-08-13T08:49:36.279Z | call_stream | [11] filterReceivedMessage of length 164
2020-08-13T08:49:36.279Z | call_stream | [11] pushing to reader message of length 159
2020-08-13T08:49:36.286Z | channel | dns:worker2.example.com:30011 createCall [12] method="/orderer.AtomicBroadcast/Broadcast", deadline=Infinity
2020-08-13T08:49:36.286Z | call_stream | [12] Sending metadata
2020-08-13T08:49:36.286Z | channel | Pick result: COMPLETE subchannel: 10.100.136.32:30011 status: undefined undefined
2020-08-13T08:49:36.287Z | call_stream | [12] write() called with message of length 5483
2020-08-13T08:49:36.287Z | call_stream | [12] deferring writing data chunk of length 5488
2020-08-13T08:49:36.287Z | subchannel | Starting stream with headers
grpc-accept-encoding: identity,deflate,gzip
accept-encoding: identity,gzip
:authority: worker2.example.com
user-agent: grpc-node-js/1.0.3
content-type: application/grpc
:method: POST
:path: /orderer.AtomicBroadcast/Broadcast
te: trailers
2020-08-13T08:49:36.287Z | call_stream | [12] attachHttp2Stream from subchannel 10.100.136.32:30011
2020-08-13T08:49:36.287Z | subchannel | 10.100.136.32:30011 callRefcount 0 -> 1
2020-08-13T08:49:36.287Z | call_stream | [12] sending data chunk of length 5488 (deferred)
2020-08-13T08:49:36.287Z | call_stream | [10] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.287Z | call_stream | [10] receive HTTP/2 data frame of length 164
2020-08-13T08:49:36.287Z | call_stream | [10] parsed message of length 164
2020-08-13T08:49:36.287Z | call_stream | [10] filterReceivedMessage of length 164
2020-08-13T08:49:36.288Z | call_stream | [10] pushing to reader message of length 159
2020-08-13T08:49:36.315Z | call_stream | [12] Received server headers:
:status: 200
content-type: application/grpc
2020-08-13T08:49:36.315Z | call_stream | [12] receive HTTP/2 data frame of length 8
2020-08-13T08:49:36.316Z | call_stream | [12] parsed message of length 8
2020-08-13T08:49:36.316Z | call_stream | [12] filterReceivedMessage of length 8
2020-08-13T08:49:36.316Z | call_stream | [12] pushing to reader message of length 3
2020-08-13T08:49:36.319Z | call_stream | [12] end() called
2020-08-13T08:49:36.319Z | call_stream | [12] calling end() on HTTP/2 stream
2020-08-13T08:49:36.351Z | call_stream | [12] Received server trailers:
grpc-status: 0
grpc-message:
2020-08-13T08:49:36.351Z | call_stream | [12] received status code 0 from server
2020-08-13T08:49:36.352Z | call_stream | [12] received status details string "" from server
2020-08-13T08:49:36.352Z | call_stream | [12] ended with status: code=0 details=""
2020-08-13T08:49:36.352Z | subchannel | 10.100.136.32:30011 callRefcount 1 -> 0
2020-08-13T08:49:36.352Z | call_stream | [12] cancelWithStatus code: 1 details: "Cancelled on client"
2020-08-13T08:49:36.352Z | call_stream | [12] ended with status: code=1 details="Cancelled on client"
2020-08-13T08:49:36.352Z | call_stream | [12] HTTP/2 stream closed with code 0
2020-08-13T08:49:38.336Z | call_stream | [10] receive HTTP/2 data frame of length 91
2020-08-13T08:49:38.336Z | call_stream | [10] parsed message of length 91
2020-08-13T08:49:38.336Z | call_stream | [10] filterReceivedMessage of length 91
2020-08-13T08:49:38.336Z | call_stream | [10] pushing to reader message of length 86
2020-08-13T08:49:38.336Z | call_stream | [9] receive HTTP/2 data frame of length 91
2020-08-13T08:49:38.336Z | call_stream | [9] parsed message of length 91
2020-08-13T08:49:38.336Z | call_stream | [9] filterReceivedMessage of length 91
2020-08-13T08:49:38.336Z | call_stream | [9] pushing to reader message of length 86
2020-08-13T08:49:38.337Z | call_stream | [11] receive HTTP/2 data frame of length 91
2020-08-13T08:49:38.337Z | call_stream | [11] parsed message of length 91
2020-08-13T08:49:38.337Z | call_stream | [11] filterReceivedMessage of length 91
2020-08-13T08:49:38.337Z | call_stream | [11] pushing to reader message of length 86
2020-08-13T08:49:39.240Z - error: [EventService]: EventService[org1-peer1] timed out after:3000
2020-08-13T08:49:39.241Z - error: [EventService]: send[org1-peer1] - #1 - Starting stream to org1-peer1 failed
Client code:
'use strict';
const FabricCAServices = require('fabric-ca-client');
const { Wallets, Gateway } = require('fabric-network');
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const async = require("async");
const user = 'benchmark';
const userpw = 'benchmarkPW';
const mspID = 'Org1MSP';
const BENCHMARK_CONCURRENCY = 1;
const BENCHMARK_OPERATIONS = 3;
const txQueue = async.queue(async (task) => {
console.log('--> Starting task');
await task;
}, BENCHMARK_CONCURRENCY);
const connectionPath = path.join(process.cwd(), 'gateway/connection.yaml');
const data = fs.readFileSync(connectionPath);
const ccp = yaml.safeLoad(data);
async function createWallet() {
try {
const walletPath = path.join(process.cwd(), 'identity/wallet');
const wallet = await Wallets.newFileSystemWallet(walletPath);
return wallet;
} catch (error) {
console.error(`Error: ${error}`);
}
}
async function enrollUser(wallet) {
try {
// Create a new CA client for interacting with the CA.
const caTLSCACerts = ccp.certificateAuthorities['org1-ca'].tlsCACerts.pem;
const caUrl = ccp.certificateAuthorities['org1-ca'].url;
const ca = new FabricCAServices(caUrl, { trustedRoots: caTLSCACerts, verify: false }, 'CA');
// Check to see if we've already enrolled the user.
const userExists = await wallet.get(user);
if (userExists) {
console.log(`An identity for the client user "${user}" already exists in the wallet`);
} else {
// Enroll signing material
let enrollment = await ca.enroll({ enrollmentID: user, enrollmentSecret: userpw });
let x509Identity = {
credentials: {
certificate: enrollment.certificate,
privateKey: enrollment.key.toBytes(),
},
mspId: mspID,
type: 'X.509',
};
await wallet.put(user, x509Identity);
console.log(`Successfully enrolled msp for user "${user}" and imported it into the wallet`);
const tlsca = new FabricCAServices(caUrl, { trustedRoots: caTLSCACerts, verify: false }, `TLSCA`);
enrollment = await tlsca.enroll({ enrollmentID: user, enrollmentSecret: userpw, profile: 'tls' });
x509Identity = {
credentials: {
certificate: enrollment.certificate,
privateKey: enrollment.key.toBytes(),
},
mspId: mspID,
type: 'X.509',
};
await wallet.put(`${user}-tls`, x509Identity);
console.log(`Successfully enrolled tls-msp for user "${user}" and imported it into the wallet`);
}
} catch (error) {
console.error(`Error enrolling user "${user}": ${error}`);
process.exit(1);
}
}
async function startBenchmark(wallet) {
try {
const gateway = new Gateway();
let connectionOptions = {
identity: `${user}`,
clientTlsIdentity: `${user}-tls`,
wallet: wallet,
discovery: { enabled: false, asLocalhost: false },
};
await gateway.connect(ccp, connectionOptions);
const network = await gateway.getNetwork('channel1');
const contract = network.getContract('cc-abac');
let startTime = 0;
let left = BENCHMARK_OPERATIONS;
startTime = Date.now();
while (left > 0) {
txQueue.push(contract.submitTransaction('invoke', 'a', 'b', '1'));
left--;
}
await txQueue.drain();
let endTime = Date.now();
let duration = (endTime - startTime) / 1000;
let tps = BENCHMARK_OPERATIONS / duration;
console.log('======== Benchmark finished ========');
console.log(`Processed ${BENCHMARK_OPERATIONS} ops in ${duration} seconds. TPS: ${tps}`);
gateway.disconnect();
process.exit(0);
} catch (error) {
console.error(`Got error:": ${error}`);
process.exit(1);
}
}
async function main() {
try {
const wallet = await createWallet();
await enrollUser(wallet);
await startBenchmark(wallet);
} catch (error) {
console.error(`Error: ${error}`);
process.exit(1);
}
}
main();
Connection Profile:
name: "Network"
version: "1.1"
client:
organization: Org1
connection:
timeout:
peer:
endorser: 120
eventHub: 60
eventReg: 30
orderer: 30
options:
grpc.keepalive_timeout_ms: 10000
channels:
channel1:
orderers:
- org1-orderer
- org2-orderer
- org3-orderer
peers:
- org1-peer1
- org2-peer1
- org3-peer1
organizations:
Org1:
mspid: Org1MSP
peers:
- org1-peer1
certificateAuthorities:
- org1-ca
Org2:
mspid: Org2MSP
peers:
- org2-peer1
certificateAuthorities:
- org2-ca
Org3:
mspid: Org3MSP
peers:
- org3-peer1
certificateAuthorities:
- org3-ca
certificateAuthorities:
org1-ca:
url: https://worker2.example.com:30051
tlsCACerts:
path: "./crypto/org1-tls-ca-ca-cert.pem"
httpOptions:
verify: false
caName: CA
org2-ca:
url: https://worker2.example.com:30052
tlsCACerts:
path: "./crypto/org2-tls-ca-ca-cert.pem"
httpOptions:
verify: false
caName: CA
org3-ca:
url: https://worker2.example.com:30053
tlsCACerts:
path: "./crypto/org3-tls-ca-ca-cert.pem"
httpOptions:
verify: false
caName: CA
orderers:
org1-orderer:
url: grpcs://worker2.example.com:30011
grpcOptions:
ssl-target-name-override: worker2.example.com
tlsCACerts:
path: "./crypto/org1-tls-ca-ca-cert.pem"
org2-orderer:
url: grpcs://worker2.example.com:30012
grpcOptions:
ssl-target-name-override: worker2.example.com
tlsCACerts:
path: "./crypto/org2-tls-ca-ca-cert.pem"
org3-orderer:
url: grpcs://worker2.example.com:30013
grpcOptions:
ssl-target-name-override: worker2.example.com
tlsCACerts:
path: "./crypto/org3-tls-ca-ca-cert.pem"
peers:
org1-peer1:
url: grpcs://worker2.example.com:30151
httpOptions:
verify: false
grpcOptions:
ssl-target-name-override: worker2.example.com
tlsCACerts:
path: "./crypto/org1-tls-ca-ca-cert.pem"
org2-peer1:
url: grpcs://worker2.example.com:30161
httpOptions:
verify: false
grpcOptions:
ssl-target-name-override: worker2.example.com
tlsCACerts:
path: "./crypto/org2-tls-ca-ca-cert.pem"
org3-peer1:
url: grpcs://worker2.example.com:30171
httpOptions:
verify: false
grpcOptions:
ssl-target-name-override: worker2.example.com
tlsCACerts:
path: "./crypto/org3-tls-ca-ca-cert.pem"
Versions used:
HLF: 2.1
Node SDK: 2.2
Node: 10.22
Every idea is highly appreciated!

That error is generated when no events are received within a timeout window after connecting the event service to receive block events from peers. It's possible that this one peer is not responding but transactions can still flow as there are enough contactable peers for endorsement to be successful. If the logs confirm that all of your peers are communicating correctly and your transactions are all executing OK then probably this error is spurious and you can ignore it.
However, even if the error log is spurious, it would be nice if it wasn't there. It might be that an unsuccessful reconnect is being triggered due to ordering of operations within the Gateway.disconnect() process but I'm just guessing here. It might be worth raising a bug report in Jira against the Node SDK for further investigation:
https://jira.hyperledger.org/projects/FABN

Related

How to use ThreadPoolExecutor with an Excel file as input and scrape date from a website

I'm trying to input zip codes taken from a predefined excel file into a website to fetch populated results and write them back to the same file in a new column. To be specific, each zip code should produce a household number, which is what I want to record and enter in the final column of the excel file.
With my current attempt, the script is doing fine. What I wish to do now is apply concurrent.futures library within the script to make it faster.
import concurrent.futures as futures
from openpyxl import load_workbook
from bs4 import BeautifulSoup
import requests
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9,bn;q=0.8',
'referer': 'https://www.unitedstateszipcodes.org/60634/'
}
link = 'https://www.unitedstateszipcodes.org/{}/'
def get_content(company,url):
res = requests.get(url, headers=headers)
soup = BeautifulSoup(res.text,"lxml")
household = int(soup.select_one("th:-soup-contains('Occupied Housing Units') + td").get_text(strip=True).replace(",",""))
company.offset(0,3).value = household
return household
if __name__ == '__main__':
wb = load_workbook('input.xlsx')
ws = wb['result']
for company in ws['B']:
if company.value == "Zip Code": continue
if not company.value: break
content_url = link.format(company.value)
print(get_content(company,content_url))
wb.save('input.xlsx')
# if __name__ == "__main__":
# wb = load_workbook('input.xlsx')
# ws = wb['result']
# with futures.ThreadPoolExecutor(max_workers=6) as executor:
# future_to_url = {
# executor.submit(get_content, company, link.format(company.value)): company for company in ws['B']
# }
# futures.as_completed(future_to_url)
# wb.save('input.xlsx')
Here is the excel file for your consideration and this is how it looks like.
How about trying this?
Note: I've refactored your code for clarity and simplicity.
import concurrent.futures as futures
import pandas as pd
import requests
from bs4 import BeautifulSoup
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9,bn;q=0.8',
'referer': 'https://www.unitedstateszipcodes.org/60634/'
}
def get_content(url: str) -> int:
return int(
BeautifulSoup(session.get(url, headers=headers).text, "lxml")
.select_one("th:-soup-contains('Occupied Housing Units') + td")
.get_text(strip=True)
.replace(",", "")
)
if __name__ == '__main__':
df = pd.read_excel('input.xlsx')
with requests.Session() as session:
with futures.ThreadPoolExecutor(max_workers=6) as executor:
future_to_url = {
executor.submit(
get_content,
f'https://www.unitedstateszipcodes.org/{zip_code}/'
): zip_code for zip_code in df['Zip Code']
}
futures.as_completed(future_to_url)
for future in future_to_url:
df.loc[df['Zip Code'] == future_to_url[future], 'Total households'] = future.result()
print(df.to_markdown(index=False))
df.to_excel('output.xlsx', index=False)
This should print:
| State | Zip Code | High Speed | 100M | Total households |
|:--------|-----------:|-------------:|-------:|-------------------:|
| IL | 60618 | 32198 | 3038 | 35407 |
| IL | 60647 | 29868 | 3526 | 34330 |
| IL | 60641 | 18340 | 1811 | 24770 |
| IL | 60634 | 17743 | 1544 | 25712 |
| IL | 60402 | 14554 | 1533 | 21338 |
| CA | 95969 | 12074 | 0 | 12475 |
| NC | 28269 | 13071 | 209 | 27076 |
| TX | 78245 | 10094 | 326 | 17691 |
| IL | 60622 | 15794 | 6519 | 24124 |
| IL | 60630 | 11730 | 1852 | 20497 |
| CA | 90280 | 12637 | 92 | 23278 |
| CA | 90026 | 9878 | 191 | 24956 |
| TX | 78207 | 9140 | 14 | 15851 |
| CA | 94112 | 11608 | 2129 | 21975 |
| TX | 78228 | 8957 | 147 | 18890 |
| CA | 90201 | 7450 | 11 | 24104 |
| FL | 32828 | 7586 | 338 | 20057 |
| GA | 30043 | 9045 | 189 | 25997 |
| GA | 30349 | 10507 | 656 | 25422 |
| FL | 33027 | 7457 | 54 | 21028 |
And you should also get an Excel file output.xlsx with the same data as above.

Unable to connect to the PYMQI Client facing FAILED: MQRC_ENVIRONMENT_ERROR

I am getting the below error while connecting to IBM MQ using library pymqi.
Its a clustered MQ channel
Traceback (most recent call last):
File "postToQueue.py", line 432, in <module>
qmgr = pymqi.connect(queue_manager, channel, conn_info)
File "C:\Python\lib\site-packages\pymqi\__init__.py", line 2608, in connect
qmgr.connect_tcp_client(queue_manager or '', CD(), channel, conn_info, user, password)
File "C:\Python\lib\site-packages\pymqi\__init__.py", line 1441, in connect_tcp_client
self.connect_with_options(name, cd, user=user, password=password)
File "C:\Python\lib\site-packages\pymqi\__init__.py", line 1423, in connect_with_options
raise MQMIError(rv[1], rv[2])
pymqi.MQMIError: MQI Error. Comp: 2, Reason 2012: FAILED: MQRC_ENVIRONMENT_ERROR'
Please see my code below.
queue_manager = 'quename here'
channel = 'channel name here'
host ='host-name here'
port = '2333'
queue_name = 'queue name here'
message = 'my message here'
conn_info = '%s(%s)' % (host, port)
print(conn_info)
qmgr = pymqi.connect(queue_manager, channel, conn_info)
queue = pymqi.Queue(qmgr, queue_name)
queue.put(message)
print("message sent")
queue.close()
qmgr.disconnect()
Getting error at the line below
qmgr = pymqi.connect(queue_manager, channel, conn_info)
Added the IBM client to scripts folder as well , using Windows 10 , Python 3.8.1 and IBM Client 9.1 windows client installation image, Below is the header
-----------------------------------------------------------------------------+
| |
| WebSphere MQ First Failure Symptom Report |
| ========================================= |
| |
| Date/Time :- Tue January 28 2020 16:27:51 Eastern Standard Time |
| UTC Time :- 1580246871.853000 |
| UTC Time Offset :- -300 (Eastern Standard Time) |
| Host Name :- CA-LDLD0SQ2 |
| Operating System :- Windows 10 Enterprise x64 Edition, Build 17763 |
| PIDS :- 5724H7251 |
| LVLS :- 8.0.0.11 |
| Product Long Name :- IBM MQ for Windows (x64 platform) |
| Vendor :- IBM |
| O/S Registered :- 0 |
| Data Path :- C:\Python\Scripts\IBM |
| Installation Path :- C:\Python |
| Installation Name :- MQNI08000011 (126) |
| License Type :- Unknown |
| Probe Id :- XC207013 |
| Application Name :- MQM |
| Component :- xxxInitialize |
| SCCS Info :- F:\build\slot1\p800_P\src\lib\cs\amqxeida.c, |
| Line Number :- 5085 |
| Build Date :- Dec 12 2018 |
| Build Level :- p800-011-181212.1 |
| Build Type :- IKAP - (Production) |
| UserID :- alekhya.machiraju |
| Process Name :- C:\Python\python.exe |
| Arguments :- |
| Addressing mode :- 32-bit |
| Process :- 00010908 |
| Thread :- 00000001 |
| Session :- 00000001 |
| UserApp :- TRUE |
| Last HQC :- 0.0.0-0 |
| Last HSHMEMB :- 0.0.0-0 |
| Last ObjectName :- |
| Major Errorcode :- xecF_E_UNEXPECTED_SYSTEM_RC |
| Minor Errorcode :- OK |
| Probe Type :- INCORROUT |
| Probe Severity :- 2 |
| Probe Description :- AMQ6090: MQM could not display the text for error |
| 536895781. |
| FDCSequenceNumber :- 0 |
| Comment1 :- WinNT error 1082155270 from Open ccsid.tbl. |
| |
+-----------------------------------------------------------------------------+

Detect VP8 Key Frame(I-Frame) in RTP stream

I need to detect VP8 Key Frame in RTP packet. I know how to remove RTP header and get the payload.
Does it have a specific signature/header?
There is an RFC for VP8 which explains how to do detect if a frame is a key frame. See section 19.1.
| Frame Tag | Type |
| ------------------------------------------------- | ----- |
| frame_tag | f(24) |
| if (key_frame) { | |
| start_code | f(24) |
| horizontal_size_code | f(16) |
| vertical_size_code | f(16) |
| } | |
The 3-byte frame tag can be parsed as follows:
---- Begin code block --------------------------------------
unsigned char *c = pbi->source;
unsigned int tmp;
tmp = (c[2] << 16) | (c[1] << 8) | c[0];
key_frame = tmp & 0x1;
version = (tmp >> 1) & 0x7;
show_frame = (tmp >> 4) & 0x1;
first_part_size = (tmp >> 5) & 0x7FFFF;
---- End code block ----------------------------------------

UHD USRP device lacks capacity

I'm using Redhawk 1.10.0 on a CentOS 6.5 machine 64 bit and USRP b100 with UHD driver 3.7.2.
The USRP b100 is recognized correctly by the system. It is a USB device.
I downloaded the latest version of UHD_USRP Device ver. 3.0 for REDHAWK and I created a Node including a GPP and a UHD_USRP devices.
The Node is started without any problem but when I run a simple waveform to read data from the USRP as a RX_DIGITIZER I got the following error:
Failed to create application: usrp_test_248_173059195 Failed to satisfy 'usesdevice'
dependencies DCE:18964b3d-392e-4b98-a90d-0569b5d46ffefor application 'usrp_test_248_173059195'
IDL:CF/ApplicationFactory/CreateApplicationError:1.0
The log of the Device Manager reports that:
2014-09-05 17:31:03 TRACE FrontendTunerDevice:369 - CORBA::Boolean frontend::FrontendTunerDevice<TunerStatusStructType>::allocateCapacity(const CF::Properties&) [with TunerStatusStructType = frontend_tuner_status_struct_struct]
2014-09-05 17:31:03 INFO FrontendTunerDevice:502 - allocateCapacity: NO AVAILABLE TUNER. Make sure that the device has an initialized frontend_tuner_status
2014-09-05 17:31:03 TRACE FrontendTunerDevice:578 - void frontend::FrontendTunerDevice<TunerStatusStructType>::deallocateCapacity(const CF::Properties&) [with TunerStatusStructType = frontend_tuner_status_struct_struct]
2014-09-05 17:31:03 DEBUG FrontendTunerDevice:603 - ALLOCATION_ID NOT FOUND: [usrpAllocation]
2014-09-05 17:31:03 DEBUG FrontendTunerDevice:637 - ERROR WHEN DEALLOCATING. SKIPPING...
The Node console:
2014-09-05 17:31:39 TRACE ApplicationFactory_impl:2132 - Done building Component Info From SPD File
2014-09-05 17:31:39 TRACE ApplicationFactory_impl:1040 - Application has 1 usesdevice dependencies
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::allocation_id
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::bandwidth
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::center_frequency
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::group_id
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::rf_flow_id
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::sample_rate
2014-09-05 17:31:39 TRACE prop_utils:509 - setting struct item FRONTEND::tuner_allocation::tuner_type
2014-09-05 17:31:39 TRACE AllocationManager_impl:134 - Servicing 1 allocation request(s)
2014-09-05 17:31:39 TRACE AllocationManager_impl:144 - Allocation request DCE:18964b3d-392e-4b98-a90d-0569b5d46ffe contains 3 properties
2014-09-05 17:31:39 TRACE AllocationManager_impl:243 - Allocating against device uhd_node:USRP_UHD_1
2014-09-05 17:31:39 TRACE AllocationManager_impl:353 - Matching DCE:cdc5ee18-7ceb-4ae6-bf4c-31f983179b4d 'FRONTEND::TUNER' eq 'FRONTEND::TUNER'
2014-09-05 17:31:39 TRACE AllocationManager_impl:353 - Matching DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb 'USRP' eq 'USRP'
2014-09-05 17:31:39 TRACE AllocationManager_impl:395 - Adding external property FRONTEND::tuner_allocation
2014-09-05 17:31:39 TRACE AllocationManager_impl:407 - Matched 2 properties
2014-09-05 17:31:39 TRACE AllocationManager_impl:264 - Allocating 1 properties (1 calls)
2014-09-05 17:31:39 TRACE AllocationManager_impl:267 - Device lacks sufficient capacity
2014-09-05 17:31:39 TRACE AllocationManager_impl:243 - Allocating against device uhd_node:GPP_1
2014-09-05 17:31:39 TRACE AllocationManager_impl:353 - Matching DCE:cdc5ee18-7ceb-4ae6-bf4c-31f983179b4d 'GPP' eq 'FRONTEND::TUNER'
2014-09-05 17:31:39 TRACE AllocationManager_impl:248 - Matching failed
2014-09-05 17:31:39 DEBUG ApplicationFactory_impl:1060 - Failed to satisfy 'usesdevice' dependencies DCE:18964b3d-392e-4b98-a90d-0569b5d46ffefor application 'usrp_test_248_173059195'
2014-09-05 17:31:39 TRACE ApplicationFactory_impl:528 - Unbinding the naming context
2014-09-05 17:31:39 TRACE Properties:85 - Destruction for properties
2014-09-05 17:31:39 TRACE PRF:312 - Deleting PRF containing 4 properties
I used the following parameters:
<usesdevicedependencies>
<usesdevice id="DCE:18964b3d-392e-4b98-a90d-0569b5d46ffe"
type="usesUSRP">
<propertyref refid="DCE:cdc5ee18-7ceb-4ae6-bf4c-31f983179b4d"
value="FRONTEND::TUNER" />
<propertyref refid="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb"
value="USRP" />
<structref refid="FRONTEND::tuner_allocation">
<simpleref refid="FRONTEND::tuner_allocation::tuner_type"
value="RX_DIGITIZER" />
<simpleref refid="FRONTEND::tuner_allocation::allocation_id"
value="usrpAllocation" />
<simpleref refid="FRONTEND::tuner_allocation::center_frequency"
value="102500000" />
<simpleref refid="FRONTEND::tuner_allocation::bandwidth"
value="320000" />
<simpleref refid="FRONTEND::tuner_allocation::sample_rate"
value="250000" />
<simpleref refid="FRONTEND::tuner_allocation::group_id"
value="" />
<simpleref refid="FRONTEND::tuner_allocation::rf_flow_id"
value="" />
</structref>
</usesdevice>
</usesdevicedependencies>
The b100 configuration is the following:
-- USRP-B100 clock control: 10
-- r_counter: 2
-- a_counter: 0
-- b_counter: 20
-- prescaler: 8
-- vco_divider: 5
-- chan_divider: 5
-- vco_rate: 1600.000000MHz
-- chan_rate: 320.000000MHz
-- out_rate: 64.000000MHz
--
_____________________________________________________
/
| Device: B-Series Device
| _____________________________________________________
| /
| | Mboard: B100
| | revision: 8192
| | serial: E5R10Z1B1
| | FW Version: 4.0
| | FPGA Version: 11.4
| |
| | Time sources: none, external, _external_
| | Clock sources: internal, external, auto
| | Sensors: ref_locked
| | _____________________________________________________
| | /
| | | RX DSP: 0
| | | Freq range: -32.000 to 32.000 Mhz
| | _____________________________________________________
| | /
| | | RX Dboard: A
| | | ID: WBX v3, WBX v3 + Simple GDB (0x0057)
| | | Serial: E5R1BW6XW
| | | _____________________________________________________
| | | /
| | | | RX Frontend: 0
| | | | Name: WBXv3 RX+GDB
| | | | Antennas: TX/RX, RX2, CAL
| | | | Sensors: lo_locked
| | | | Freq range: 68.750 to 2200.000 Mhz
| | | | Gain range PGA0: 0.0 to 31.5 step 0.5 dB
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Codec: A
| | | | Name: ad9522
| | | | Gain range pga: 0.0 to 20.0 step 1.0 dB
| | _____________________________________________________
| | /
| | | TX DSP: 0
| | | Freq range: -32.000 to 32.000 Mhz
| | _____________________________________________________
| | /
| | | TX Dboard: A
| | | ID: WBX v3 (0x0056)
| | | Serial: E5R1BW6XW
| | | _____________________________________________________
| | | /
| | | | TX Frontend: 0
| | | | Name: WBXv3 TX+GDB
| | | | Antennas: TX/RX, CAL
| | | | Sensors: lo_locked
| | | | Freq range: 68.750 to 2200.000 Mhz
| | | | Gain range PGA0: 0.0 to 31.0 step 1.0 dB
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Codec: A
| | | | Name: ad9522
| | | | Gain range pga: -20.0 to 0.0 step 0.1 dB
Where's my fault?
Thanks in advance for any help.
The frontend_tuner_status struct sequence is what defines the device capabilities and capacity. If the sequence is empty, the allocation will always result in lack of capacity. An empty frontend_tuner_status property is usually the result of not specifying the target device, or not being able to find the specified target device.
You must specify the target device using the target_device struct property. This can be done within the Node or at run-time. Previous versions of the USRP_UHD REDHAWK Device only allowed the IP address to be specified using a property, but in order to support USB-connected (and in general, non-network-connected) USRP devices, this has been replaced with the target_device struct property.
The target_device property allows the user to specify ip_address, name, serial, or type, and will use the first USRP hardware device that meets the criteria, if one is found. The information that should be specified in the target_device struct can be determined by setting the update_available_devices property to true, causing the available_devices struct sequence to be populated with all found devices (the same devices and information that is reported by the command line tool uhd_find_devices).
To determine if the USRP_UHD REDHAWK Device is connected to a target device, inspect the properties. Specifically, frontend_tuner_status sequence will be empty if not linked to a hardware device, as well as the device_motherboards and device_channels properties.

How to include modules for code coverage for unit testing?

My assumption is that any module tested using Intern will automatically be covered by Istanbul's code coverage. For reasons unknown to me, my module is not being included.
I am:
running Intern 1.6.2 (installed with npm locally)
testing NodeJS code
using callbacks, not promises
using CommonJS modules, not AMD modules
Directory Structure (only showing relevant files):
plister
|
|--libraries
| |--file-type-support.js
|
|--tests
| |--intern.js
| |--unit
| |--file-type-support.js
|
|--node_modules
|--intern
plister/tests/intern.js
define({
useLoader: {
'host-node': 'dojo/dojo'
},
loader: {
packages: [
{name: 'libraries', location: 'libraries'}
]
},
reporters: ['console'],
suites: ['tests/unit/file-type-support'],
functionalSuites: [],
excludeInstrumentation: /^(tests|node_modules)\//
});
plister/tests/unit/file-type-support.js
define([
'intern!bdd',
'intern/chai!expect',
'intern/dojo/node!fs',
'intern/dojo/node!path',
'intern/dojo/node!stream-equal',
'intern/dojo/node!../../libraries/file-type-support'
], function (bdd, expect, fs, path, streamEqual, fileTypeSupport) {
'use strict';
bdd.describe('file-type-support', function doTest() {
bdd.it('should show that the example output.plist matches the ' +
'temp.plist generated by the module', function () {
var deferred = this.async(),
input = path.normalize('tests/resources/input.plist'),
output = path.normalize('tests/resources/output.plist'),
temporary = path.normalize('tests/resources/temp.plist');
// Test deactivate function by checking output produced by
// function against test output.
fileTypeSupport.deactivate(fs.createReadStream(input),
fs.createWriteStream(temporary),
deferred.rejectOnError(function onFinish() {
streamEqual(fs.createReadStream(output),
fs.createReadStream(temporary),
deferred.callback(function checkEqual(error, equal) {
expect(equal).to.be.true;
}));
}));
});
});
});
Output:
PASS: main - file-type-support - should show that the example output.plist matches the temp.plist generated by the module (29ms)
1/1 tests passed
1/1 tests passed
Output (on failure):
FAIL: main - file-type-support - should show that the example output.plist matches the temp.plist generated by the module (30ms)
AssertionError: expected true to be false
AssertionError: expected true to be false
0/1 tests passed
0/1 tests passed
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
Output (after removing excludeInstrumentation):
PASS: main - file-type-support - should show that the example output.plist matches the temp.plist generated by the module (25ms)
1/1 tests passed
1/1 tests passed
------------------------------------------+-----------+-----------+-----------+-----------+
File | % Stmts |% Branches | % Funcs | % Lines |
------------------------------------------+-----------+-----------+-----------+-----------+
node_modules/intern/ | 70 | 50 | 100 | 70 |
chai.js | 70 | 50 | 100 | 70 |
node_modules/intern/lib/ | 79.71 | 42.86 | 72.22 | 79.71 |
Test.js | 79.71 | 42.86 | 72.22 | 79.71 |
node_modules/intern/lib/interfaces/ | 80 | 50 | 63.64 | 80 |
bdd.js | 100 | 100 | 100 | 100 |
tdd.js | 76.19 | 50 | 55.56 | 76.19 |
node_modules/intern/lib/reporters/ | 56.52 | 35 | 57.14 | 56.52 |
console.js | 56.52 | 35 | 57.14 | 56.52 |
node_modules/intern/node_modules/chai/ | 37.9 | 8.73 | 26.38 | 39.34 |
chai.js | 37.9 | 8.73 | 26.38 | 39.34 |
tests/unit/ | 100 | 100 | 100 | 100 |
file-type-support.js | 100 | 100 | 100 | 100 |
------------------------------------------+-----------+-----------+-----------+-----------+
All files | 42.14 | 11.35 | 33.45 | 43.63 |
------------------------------------------+-----------+-----------+-----------+-----------+
My module passes the test and I can make it fail too. It just will not show up in the code coverage. I have done the tutorial hosted on GitHub without any problems.
I tried dissecting the Istanbul and Intern dependencies. I place a console.log where it seems files to be covered go through, but my module doesn't get passed. I have tried every variation of deferred.callback and deferred.rejectOnError with no difference to the code coverage.
Also, any feedback on my use of deferred.callback and deferred.rejectOnError will be greatly appreciated. I am still a little uncertain on their usage.
Thanks!
As of Intern 1.6, only require('vm').runInThisContext is hooked to add code coverage data, not require. Instrumentation of require was added in Intern 2.0.
The use of callback/rejectOnError in the above code is correct.

Resources