Skip to content

Commit

Permalink
Merge pull request #11 from richm/master
Browse files Browse the repository at this point in the history
allow loader parameters to be passed to container as env vars
  • Loading branch information
richm authored Feb 22, 2018
2 parents 8d9512d + cee0c53 commit 082b821
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
FROM registry.fedoraproject.org/fedora
RUN dnf -y install python
COPY ./loader /
RUN chmod +x /loader
#CMD ["/loader", "--msgpersec=10", "--report-interval=40"]
FROM registry.fedoraproject.org/fedora

ENV MSGPERSEC=0 REPORT_INTERVAL=10 PAYLOAD_SIZE=1024 \
DISTRIBUTION=gaussian PAYLOAD_GEN=random \
STDDEV=32 OUTPUT=stdout REPORT=inline \
TOTAL_SIZE=0

RUN dnf -y install python
COPY ./loader /
RUN chmod +x /loader
# build like this:
# docker build -t loader-container .
# run like this:
# contid=$( docker run -e MSGPERSEC=10 -e STDDEV=16 -d loader-container )
# docker logs $contid
# docker stop $contid
# docker rm $contid
CMD /loader --msgpersec=${MSGPERSEC} --report-interval=${REPORT_INTERVAL} --total-size=${TOTAL_SIZE} --distribution=${DISTRIBUTION} --payload-gen=${PAYLOAD_GEN} --stddev=${STDDEV} --output=${OUTPUT} --report=${REPORT} ${PAYLOAD_SIZE}
8 changes: 8 additions & 0 deletions verify-loader
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ import sys
import os
import time
import argparse
import signal
from collections import defaultdict

REPORT_INTERVAL = 10
MB = 1024 * 1024

# if running verify-loader as a background process,
# we can still do a kill -2 $pid to make it exit
# the main loop and print the stats
def handle_sig_int(signum, frame):
raise KeyboardInterrupt

signal.signal(signal.SIGINT, handle_sig_int)

class Context(object):

Expand Down

0 comments on commit 082b821

Please sign in to comment.