Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 25, 2023
1 parent 90f3b93 commit 26767af
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 33 deletions.
26 changes: 16 additions & 10 deletions dpgen2/exploration/task/customized_lmp_template_task_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,22 @@ def _make_customized_task_group(
# run shell command with dpgen2.utils.run_command
ret, out, err = run_command(ss, shell=True)
if ret != 0:
logging.error("".join((
f"customized shell command {ss} failed with return code {ret}\n",
"out msg",
out,
"\n",
"err msg",
err,
"\n",
)))
raise FatalError(f"customized shell command {ss} failed with return code {ret}")
logging.error(
"".join(
(
f"customized shell command {ss} failed with return code {ret}\n",
"out msg",
out,
"\n",
"err msg",
err,
"\n",
)
)
)
raise FatalError(
f"customized shell command {ss} failed with return code {ret}"
)
# loop over all pattern matched result dirs
for ff in [
ii for ii in sorted(os.listdir(os.getcwd())) if Path(ii).is_dir()
Expand Down
8 changes: 5 additions & 3 deletions dpgen2/fp/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ def run_task(
command = " ".join([command, gaussian_input_name])
ret, out, err = run_command(command, shell=True)
if ret != 0:
logging.error("".join((
"gaussian failed\n", "out msg", out, "\n", "err msg", err, "\n"
)))
logging.error(
"".join(
("gaussian failed\n", "out msg", out, "\n", "err msg", err, "\n")
)
)
raise TransientError("gaussian failed")
# convert the output to deepmd/npy format
sys = dpdata.LabeledSystem(gaussian_output_name, fmt="gaussian/log")
Expand Down
6 changes: 3 additions & 3 deletions dpgen2/fp/vasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def run_task(
command = " ".join([command, ">", log_name])
ret, out, err = run_command(command, shell=True)
if ret != 0:
logging.error("".join((
"vasp failed\n", "out msg", out, "\n", "err msg", err, "\n"
)))
logging.error(
"".join(("vasp failed\n", "out msg", out, "\n", "err msg", err, "\n"))
)
raise TransientError("vasp failed")
# convert the output to deepmd/npy format
sys = dpdata.LabeledSystem("OUTCAR")
Expand Down
32 changes: 26 additions & 6 deletions dpgen2/op/run_dp_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,19 @@ def clean_before_quit():
ret, out, err = run_command(command)
if ret != 0:
clean_before_quit()
logging.error("".join((
"dp train failed\n", "out msg", out, "\n", "err msg", err, "\n"
)))
logging.error(
"".join(
(
"dp train failed\n",
"out msg",
out,
"\n",
"err msg",
err,
"\n",
)
)
)
raise FatalError("dp train failed")
fplog.write("#=================== train std out ===================\n")
fplog.write(out)
Expand All @@ -224,9 +234,19 @@ def clean_before_quit():
ret, out, err = run_command(["dp", "freeze", "-o", "frozen_model.pb"])
if ret != 0:
clean_before_quit()
logging.error("".join((
"dp freeze failed\n", "out msg", out, "\n", "err msg", err, "\n"
)))
logging.error(
"".join(
(
"dp freeze failed\n",
"out msg",
out,
"\n",
"err msg",
err,
"\n",
)
)
)
raise FatalError("dp freeze failed")
fplog.write("#=================== freeze std out ===================\n")
fplog.write(out)
Expand Down
26 changes: 15 additions & 11 deletions dpgen2/op/run_lmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,21 @@ def execute(
command = " ".join([command, "-i", lmp_input_name, "-log", lmp_log_name])
ret, out, err = run_command(command, shell=True)
if ret != 0:
logging.error("".join((
"lmp failed\n",
"command was",
command,
"out msg",
out,
"\n",
"err msg",
err,
"\n",
)))
logging.error(
"".join(
(
"lmp failed\n",
"command was",
command,
"out msg",
out,
"\n",
"err msg",
err,
"\n",
)
)
)
raise TransientError("lmp failed")

ret_dict = {
Expand Down

0 comments on commit 26767af

Please sign in to comment.