Skip to content

Commit e2b6fd5

Browse files
shazj99Zhengju Sha
authored andcommitted
autotest: rename task directory to avoid false result in a rerun (deepmodeling#572)
Change-Id: Ia138ee7c31b6c41d9f41f5943affa9ebf8803c46 Co-authored-by: Zhengju Sha <[email protected]>
1 parent 8496bcb commit e2b6fd5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

dpgen/auto_test/common_equi.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from distutils.version import LooseVersion
1414
from dpgen.dispatcher.Dispatcher import make_submission
1515
from dpgen.remote.decide_machine import convert_mdata
16+
from dpgen.auto_test.lib.utils import create_path
17+
1618
lammps_task_type = ['deepmd', 'meam', 'eam_fs', 'eam_alloy']
1719

1820

@@ -78,10 +80,7 @@ def make_equi(confs,
7880
if not os.path.exists(poscar):
7981
raise FileNotFoundError('no configuration for autotest')
8082
relax_dirs = os.path.abspath(os.path.join(ii, 'relaxation', 'relax_task')) # to be consistent with property in make dispatcher
81-
if os.path.exists(relax_dirs):
82-
dlog.warning('%s already exists' % relax_dirs)
83-
else:
84-
os.makedirs(relax_dirs)
83+
create_path(relax_dirs)
8584
task_dirs.append(relax_dirs)
8685
os.chdir(relax_dirs)
8786
# copy POSCARs to mp-xxx/relaxation/relax_task

dpgen/auto_test/common_prop.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from dpgen.dispatcher.Dispatcher import make_dispatcher
1616
from dpgen.dispatcher.Dispatcher import make_submission
1717
from dpgen.remote.decide_machine import convert_mdata
18+
from dpgen.auto_test.lib.utils import create_path
1819
lammps_task_type = ['deepmd', 'meam', 'eam_fs', 'eam_alloy']
1920

2021

@@ -73,10 +74,7 @@ def make_property(confs,
7374
path_to_equi = os.path.join(ii, 'relaxation', 'relax_task')
7475
path_to_work = os.path.join(ii, property_type + '_' + suffix)
7576

76-
if os.path.exists(path_to_work):
77-
dlog.warning('%s already exists' % path_to_work)
78-
else:
79-
os.makedirs(path_to_work)
77+
create_path(path_to_work)
8078

8179
prop = make_property_instance(jj)
8280
task_list = prop.make_confs(path_to_work, path_to_equi, do_refine)

0 commit comments

Comments
 (0)