Created
April 27, 2017 04:51
-
-
Save manuzhang/192005539915d60c9b2ce2aa2601548c to your computer and use it in GitHub Desktop.
demo script for https://github.com/Intel-bigdata/TensorFlowOnYARN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import subprocess | |
import sys | |
# Example: | |
# python demo.py "bin/ydl-tf" "launch" "examples/between-graph/mnist_feed.py" | |
def main(): | |
args = sys.argv[1:] | |
output = subprocess.check_output([args[0], args[1]]) | |
# Typical output | |
# ClusterSpec: {"ps":["node13-3:22969"],"worker":["node13-3:22965","node13-1:22967"]} | |
cluster_spec = json.loads(output.split(' ')[1]) | |
subprocess.call(["python", args[2], "--ps_hosts=" + ','.join(cluster_spec['ps']), "--worker_hosts=" + ','.join(cluster_spec['worker']), "--task_index=" + "0"]) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment