Skip to content

Commit

Permalink
fix mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
sljlp committed Apr 6, 2023
1 parent 84bb7a9 commit 2bfe358
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions python/paddle/distributed/fleet/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def start_local_trainers(
fn = None
pre_fn = None if os.name == 'nt' else os.setsid
if log_dir is not None:
os.system(f"mkdir -p {log_dir}")
os.makedirs(log_dir, exist_ok=True)
if os.path.exists("%s/endpoints.log" % log_dir):
os.system(f"rm -f {log_dir}/endpoints.log")
with open("%s/endpoints.log" % log_dir, "w") as f:
Expand Down Expand Up @@ -1762,7 +1762,7 @@ def start_pod_server(self, args, pod):
)

if args.log_dir is not None:
os.system(f"mkdir -p {args.log_dir}")
os.makedirs(args.log_dir, exist_ok=True)
fn = open("%s/serverlog.%d" % (args.log_dir, idx), "w")
self.log_fns["server"].append(fn)
proc = subprocess.Popen(
Expand Down Expand Up @@ -1870,7 +1870,7 @@ def start_pod_worker(self, args, pod):
)

if args.log_dir is not None:
os.system(f"mkdir -p {args.log_dir}")
os.makedirs(args.log_dir, exist_ok=True)
fn = open("%s/workerlog.%d" % (args.log_dir, idx), "w")
self.log_fns["worker"].append(fn)
proc = subprocess.Popen(
Expand Down Expand Up @@ -1938,7 +1938,7 @@ def start_pod_coordinator(self, args, pod):
)

if args.log_dir is not None:
os.system(f"mkdir -p {args.log_dir}")
os.makedirs(args.log_dir, exist_ok=True)
fn = open("%s/coordinator.%d" % (args.log_dir, idx), "w")
self.log_fns["coordinator"].append(fn)
proc = subprocess.Popen(
Expand Down Expand Up @@ -2029,7 +2029,7 @@ def start_pod_heter_worker(self, args, pod):
)

if args.log_dir is not None:
os.system(f"mkdir -p {args.log_dir}")
os.makedirs(args.log_dir, exist_ok=True)
fn = open("%s/heterlog.%d" % (args.log_dir, idx), "w")
self.log_fns["heter_worker"].append(fn)
proc = subprocess.Popen(
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/fleet/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def mkdirs(self, fs_path):
assert not os.path.isfile(fs_path), "{} is already a file".format(
fs_path
)
os.system(f"mkdir -p {fs_path}")
os.makedirs(fs_path, exist_ok=True)

def rename(self, fs_src_path, fs_dst_path):
"""
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/utils/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def start_local_trainers(

fn = None
if log_dir is not None:
os.system(f"mkdir -p {log_dir}")
os.makedirs(log_dir, exist_ok=True)
fn = open("%s/workerlog.%d" % (log_dir, idx), "a")
proc = subprocess.Popen(cmd, env=current_env, stdout=fn, stderr=fn)
else:
Expand Down

0 comments on commit 2bfe358

Please sign in to comment.