85 lines
936 B
Python
85 lines
936 B
Python
|
#!/usr/bin/env python
|
||
|
# coding: utf-8
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
# wut-worker --- Runs on worker nodes
|
||
|
#
|
||
|
#
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
import os
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
# Cluster
|
||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||
|
import tensorflow as tf
|
||
|
import simplejson as json
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
# The script wut-worker launches this python script.
|
||
|
# It is better to do in the shell script, because the index has to be
|
||
|
# unique for each hostname.
|
||
|
#
|
||
|
# It has a line like:
|
||
|
# TF_CONFIG='{"cluster": {"worker": ["ml1:2222", "ml2:2222", "ml3:2222", "ml4:2222", "ml5:2222"]}, "task": {"index": 0, "type": "worker"}}' python3 wut-worker.py
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
#os.environ["TF_CONFIG"] = json.dumps({
|
||
|
# "cluster": {
|
||
|
# "worker": [ "ml1:2222", "ml2:2222", "ml3:2222", "ml4:2222", "ml5:2222" ]
|
||
|
# },
|
||
|
# "task": {"type": "worker", "index": 1},
|
||
|
# "num_workers": 5
|
||
|
#})
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# In[ ]:
|
||
|
|
||
|
|
||
|
|
||
|
|