def run_timeTests(parameter): """Runs all found tests and times them.""" cwd = os.getcwd() print(f"cwd: {cwd}") pytest_cmd = "python -m cProfile -o profile $(pytest)" myh.run(pytest_cmd)
def run_kafkaConsume(server, topic): """Launches a kafka client to start consuming a given topic.""" base_cmd = ( f"docker run spotify/kafka /opt/kafka_2.12-1.1.0/bin/kafka-console-consumer.sh " ) options = f"--bootstrap-server {server} --topic {topic}" cmd = base_cmd + options myh.run(cmd, stdout=True)
def run_dimgFilter(filter): """Filters the list of images.""" cmd = f"docker images | grep {filter}" result = myh.run(cmd) print(result.stdout.decode("utf-8"))
def run_kafkaList(server): """Command to list topics on a kafka server.""" cmd = f"docker run spotify/kafka /opt/kafka_2.12-1.1.0/bin/kafka-topics.sh --zookeeper {server} --list" topic_list = myh.run(cmd, stdout=True) print(topic_list)
def run_branchHistory(parameter): """test docstring""" cmd = ( "for branch in `git branch -r | " + 'grep -v HEAD`;do echo -e `git show --format="%ci %cr " $branch | ' + "head -n 1` \\t$branch; done | sort -r") results = myh.run(cmd, False) print(results.stdout.decode("utf-8"))
def run_dirtyBump(reltype, dryrun): """Does a dirty bumpversion run.""" if myh.isTrue(dryrun): dryrun_str = "--dry-run" else: dryrun_str = "" cmd = f"bumpversion --allow-dirty --verbose {dryrun_str} {reltype}" out = myh.run(cmd) print(out.stdout.decode("utf-8"))
def run_dockerUI(parameter): """test docstring""" cmd = "docker run -v /var/run/docker.sock:/run/docker.sock -ti -e TERM tomastomecek/sen" myh.run(cmd)
def run_dosb(parameter): """test docstring""" cmd = f"ssh [email protected]" myh.run(cmd)
#!/home/mbrooks/.local/share/virtualenvs/mbrooks-hpmZt1LH/bin/python import myhacks as myh cmds = ["docker container prune -f", "docker image prune -f"] for cmd in cmds: myh.run(cmd)