Skip to content

Commit b5f3609

Browse files
Fix SameFileError exception. (#2125)
1 parent 818d8cb commit b5f3609

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

elasticdl_client/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def init_zoo(args):
3838
raise RuntimeError(
3939
"The cluster spec {} doesn't exist".format(cluster_spec_path)
4040
)
41-
shutil.copy2(cluster_spec_path, os.getcwd())
41+
try:
42+
shutil.copy2(cluster_spec_path, os.getcwd())
43+
except shutil.SameFileError:
44+
pass
4245
cluster_spec_name = os.path.basename(cluster_spec_path)
4346

4447
# Create the docker file

elasticdl_client/common/args.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from elasticdl_client.common.constants import DistributionStrategy
1717

1818

19-
def add_zoo_init_arguments(parser):
19+
def add_zoo_init_params(parser):
2020
parser.add_argument(
2121
"--base_image",
2222
type=str,
@@ -38,7 +38,7 @@ def add_zoo_init_arguments(parser):
3838
)
3939

4040

41-
def add_zoo_build_arguments(parser):
41+
def add_zoo_build_params(parser):
4242
parser.add_argument(
4343
"path", type=str, help="The path where the build context locates."
4444
)
@@ -51,7 +51,7 @@ def add_zoo_build_arguments(parser):
5151
)
5252

5353

54-
def add_zoo_push_arguments(parser):
54+
def add_zoo_push_params(parser):
5555
parser.add_argument(
5656
"image",
5757
type=str,

elasticdl_client/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ def build_argument_parser():
4343
"init", help="Initialize the model zoo."
4444
)
4545
zoo_init_parser.set_defaults(func=init_zoo)
46-
args.add_zoo_init_arguments(zoo_init_parser)
46+
args.add_zoo_init_params(zoo_init_parser)
4747

4848
# elasticdl zoo build
4949
zoo_build_parser = zoo_subparsers.add_parser(
5050
"build", help="Build a docker image for the model zoo."
5151
)
5252
zoo_build_parser.set_defaults(func=build_zoo)
53-
args.add_zoo_build_arguments(zoo_build_parser)
53+
args.add_zoo_build_params(zoo_build_parser)
5454

5555
# elasticdl zoo push
5656
zoo_push_parser = zoo_subparsers.add_parser(
@@ -59,7 +59,7 @@ def build_argument_parser():
5959
"ElasticDL job.",
6060
)
6161
zoo_push_parser.set_defaults(func=push_zoo)
62-
args.add_zoo_push_arguments(zoo_push_parser)
62+
args.add_zoo_push_params(zoo_push_parser)
6363

6464
# elasticdl train
6565
train_parser = subparsers.add_parser(

0 commit comments

Comments
 (0)