Skip to content

Commit

Permalink
Initialize the docker client from environment instead of arguments. (#…
Browse files Browse the repository at this point in the history
…2098)

* Initialize the docker client from environment instead of the arguments.

* Initialize the docker client from environment instead of the arguments.

* Update the client doc.
  • Loading branch information
brightcoder01 authored Jul 1, 2020
1 parent 4bfc93b commit 0bc6b1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
9 changes: 2 additions & 7 deletions docs/designs/client_tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ this command-line client tool.
1. Build the Docker image for an ElasticDL job.
```bash
elasticdl zoo build
--image=a_docker_registry/bright/elasticdl-wnd:1.0
[--docker_base_url=docke_base_url]
[--docker_tlscert=docker_tlscert]
[--docker_tlskey=docker_tlskey]
.
elasticdl zoo build --image=a_docker_registry/bright/elasticdl-wnd:1.0 .
```
1. Push the Docker image to a remote registry.
Expand All @@ -79,7 +74,7 @@ this command-line client tool.
```bash
elasticdl train \
--image=a_docker_registry/bright/elasticdl-wnd:1.0 \
--image_name=a_docker_registry/bright/elasticdl-wnd:1.0 \
--model_zoo=model_zoo
--model_def=a_directory.wide_and_deep.custom_model \
--training_data=/data/mnist/train \
Expand Down
17 changes: 4 additions & 13 deletions elasticdl_client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,8 @@ def build_zoo(args):
logger.info("Build the image for the model zoo.")
# Call docker api to build the image
# Validate the image name schema
client = _get_docker_client(
docker_base_url=args.docker_base_url,
docker_tlscert=args.docker_tlscert,
docker_tlskey=args.docker_tlskey,
)
for line in client.build(
client = docker.DockerClient.from_env()
for line in client.api.build(
dockerfile="./Dockerfile",
path=args.path,
rm=True,
Expand All @@ -93,13 +89,8 @@ def build_zoo(args):
def push_zoo(args):
logger.info("Push the image for the model zoo.")
# Call docker api to push the image to remote registry
client = _get_docker_client(
docker_base_url=args.docker_base_url,
docker_tlscert=args.docker_tlscert,
docker_tlskey=args.docker_tlskey,
)

for line in client.push(args.image, stream=True, decode=True):
client = docker.DockerClient.from_env()
for line in client.api.push(args.image, stream=True, decode=True):
_print_docker_progress(line)


Expand Down
23 changes: 0 additions & 23 deletions elasticdl_client/common/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def add_zoo_build_arguments(parser):
help="The name of the docker image we are building for"
"this model zoo.",
)
add_docker_arguments(parser)


def add_zoo_push_arguments(parser):
Expand All @@ -58,28 +57,6 @@ def add_zoo_push_arguments(parser):
type=str,
help="The name of the docker image for this model zoo.",
)
add_docker_arguments(parser)


def add_docker_arguments(parser):
parser.add_argument(
"--docker_base_url",
type=str,
help="URL to the Docker server",
default="unix://var/run/docker.sock",
)
parser.add_argument(
"--docker_tlscert",
type=str,
help="Path to Docker client cert",
default="",
)
parser.add_argument(
"--docker_tlskey",
type=str,
help="Path to Docker client key",
default="",
)


def add_train_params(parser):
Expand Down

0 comments on commit 0bc6b1d

Please sign in to comment.