Skip to content

Commit

Permalink
Stop trex-app after duration time is reached
Browse files Browse the repository at this point in the history
  • Loading branch information
ramperher committed Dec 27, 2024
1 parent ef3f0eb commit 79aa42b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions trex-container-app/app/scripts/run-trex
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,16 @@ class STLS1(object):
# start monitory thread to post stats
self.start_stats_monitor()

# block until done
self.client.wait_on_traffic(ports=self.ports)
# block until done, having a timeout that expires after reaching the specified duration (if provided)
# with 1 second delay waiying after last packet is sent
if duration != -1:
try:
self.client.wait_on_traffic(ports=self.ports, timeout=duration, rx_delay_ms=1000)
except TRexTimeoutError as e:
log.info("Reached timeout, job will finish")
log.info(e)
else:
self.client.wait_on_traffic(ports=self.ports)

trexstats.force_exit = True

Expand Down

0 comments on commit 79aa42b

Please sign in to comment.