-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change script to support tensorflow distribution on k8s. #617
Conversation
docker/k8s_tools.py
Outdated
|
||
r = [] | ||
for ip in ips: | ||
if port != "0": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use port != None
as it's the default value of the function arg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docker/k8s_tools.py
Outdated
pod_list = fetch_pods_info(label_selector) | ||
pserver_ips = [item[1] for item in pod_list] | ||
return ",".join(pserver_ips) | ||
def fetch_ips(label_selector, port=None, phase=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is called fetch_ips
but trying to append ports, try using fetch_endpoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docker/k8s_tools.py
Outdated
trainer_ips.sort() | ||
|
||
def fetch_id(label_selector, phase=None): | ||
pod_list = fetch_pods_info(label_selector, phase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are the same as fetch_ips
, try put them in one function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docker/k8s_tools.py
Outdated
return fetch_endpoints(label_selector, port, phase) | ||
|
||
|
||
def fetch_pserver_ips(label_selector, port=None, phase=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused fetch_pserver_ips
called fetch_endpoints
function, fetch_endpoints
would return IP:PORT
rather than IP
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch_xxx_ips
can have no argument port
because we always use None
. And, maybe it's better to add some comments to tell if port=None
, fetch_endpoints
will return a list of IPs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docker/k8s_tools.py
Outdated
api_response = v1.list_namespaced_pod( | ||
namespace=NAMESPACE, pretty=True, label_selector=label_selector) | ||
pod_list = [] | ||
for item in api_response.items: | ||
if phase is not None and item.status.phase != phase: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If phase == "Running"
then need to check if it's Terminating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docker/k8s_tools.py
Outdated
return fetch_endpoints(label_selector, port, phase) | ||
|
||
|
||
def fetch_pserver_ips(label_selector, port=None, phase=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch_xxx_ips
can have no argument port
because we always use None
. And, maybe it's better to add some comments to tell if port=None
, fetch_endpoints
will return a list of IPs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.