Skip to content

Instantly share code, notes, and snippets.

@brentp
Created July 23, 2016 13:18
Show Gist options
  • Save brentp/02ab4904e23ebc7e132d128beb597a4e to your computer and use it in GitHub Desktop.
Save brentp/02ab4904e23ebc7e132d128beb597a4e to your computer and use it in GitHub Desktop.
testing gargs

Trying to see if we can get mixing of output. We pipe to uniq and then check that we get the same number of lines of output as input (each call to t.py produces many of the same lines so they should all get uniqed to 1.

seq 1 20 | ./gargs -p 10 "python t.py {}" | uniq | awk '{ print substr($0, 0, 10) }'

The N lines of of "1|1|1|..." or "2|2|2..." based on the sys.argv[1] where N is chosen randomly and we have random ints between each line.

import sys
import random
import time
char = sys.argv[1]
slen = 2000
# print out a unique string (of length slen) based on input. e.g. 2222222222222222...
O = "|".join([char] * slen)
# for a random number of times
for i in range(random.randint(5, 20)):
# sleep random amount
time.sleep(random.randint(0, 5))
print O
sys.stdout.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment