Skip to content

Commit 414c7b3

Browse files
wanghan-iapcmHan Wang
andauthored
Remove traj_fmt (#110)
- remove traj_fmt - fix bugs in `watch` subcommand. download file even if the watched WF is failed. - rm some printings from UTs. Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
1 parent 5465850 commit 414c7b3

File tree

6 files changed

+3
-14
lines changed

6 files changed

+3
-14
lines changed

dpgen2/entrypoint/watch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def watch(
6868

6969
finished_keys = None
7070

71-
while wf.query_status() in ["Pending", "Running"]:
71+
while wf.query_status() in ["Pending", "Running", "Failed", "Error"]:
7272
finished_keys = update_finished_steps(
7373
wf,
7474
finished_keys,
@@ -77,6 +77,8 @@ def watch(
7777
prefix=prefix,
7878
chk_pnt=chk_pnt,
7979
)
80+
if wf.query_status() in ["Failed", "Error"]:
81+
break
8082
time.sleep(frequency)
8183

8284
status = wf.query_status()

dpgen2/exploration/selector/conf_selector_frame.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ def select (
5454
Format: each line has 7 numbers they are used as
5555
# frame_id md_v_max md_v_min md_v_mean md_f_max md_f_min md_f_mean
5656
where `md` stands for model deviation, v for virial and f for force
57-
traj_fmt : str
58-
Format of the trajectory, by default it is the dump file of LAMMPS
5957
type_map : List[str]
6058
The `type_map` of the systems
6159

dpgen2/op/select_confs.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class SelectConfs(OP):
2020
def get_input_sign(cls):
2121
return OPIOSign({
2222
"conf_selector": ConfSelector,
23-
"traj_fmt": str,
2423
"type_map": List[str],
2524

2625
"trajs": Artifact(List[Path]),
@@ -48,7 +47,6 @@ def execute(
4847
Input dict with components:
4948
5049
- `conf_selector`: (`ConfSelector`) Configuration selector.
51-
- `traj_fmt`: (`str`) The format of trajectory.
5250
- `type_map`: (`List[str]`) The type map.
5351
- `trajs`: (`Artifact(List[Path])`) The trajectories generated in the exploration.
5452
- `model_devis`: (`Artifact(List[Path])`) The file storing the model deviation of the trajectory. The order of model deviation storage is consistent with that of the trajectories. The order of frames of one model deviation storage is also consistent with tat of the corresponding trajectory.
@@ -63,7 +61,6 @@ def execute(
6361
"""
6462

6563
conf_selector = ip['conf_selector']
66-
traj_fmt = ip['traj_fmt']
6764
type_map = ip['type_map']
6865

6966
trajs = ip['trajs']
@@ -72,7 +69,6 @@ def execute(
7269
confs, report = conf_selector.select(
7370
trajs,
7471
model_devis,
75-
traj_fmt = traj_fmt,
7672
type_map = type_map,
7773
)
7874

dpgen2/superop/block.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ def _block_cl(
195195
parameters={
196196
"conf_selector": block_steps.inputs.parameters['conf_selector'],
197197
"type_map": block_steps.inputs.parameters["type_map"],
198-
"traj_fmt": 'lammps/dump',
199198
},
200199
artifacts={
201200
"trajs" : prep_run_lmp.outputs.artifacts['trajs'],

tests/mocked_ops.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ def execute(
579579
name = Path(name)
580580
for ii in labeled_data:
581581
iiname = ii.name
582-
print('copy-------------------', ii, name/iiname)
583582

584583
raise FatalError
585584

@@ -607,7 +606,6 @@ def execute(
607606

608607
for ii in labeled_data:
609608
iiname = ii.name
610-
print('copy-------------------', ii, name/iiname)
611609
shutil.copytree(ii, name/iiname)
612610
fc = (name/iiname/'data').read_text()
613611
fc = "restart\n" + fc
@@ -728,7 +726,6 @@ def select (
728726
self,
729727
trajs : List[Path],
730728
model_devis : List[Path],
731-
traj_fmt : str = 'deepmd/npy',
732729
type_map : List[str] = None,
733730
) -> Tuple[List[ Path ], TrustLevel] :
734731
confs = []

tests/test_select_confs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def test(self):
5858
op = MockedSelectConfs()
5959
out = op.execute(OPIO({
6060
'conf_selector': self.conf_selector,
61-
'traj_fmt': self.traj_fmt,
6261
'type_map' : self.type_map,
6362
'trajs' : self.trajs,
6463
'model_devis' : self.model_devis,
@@ -76,7 +75,6 @@ def test(self):
7675
class TestSelectConfs(unittest.TestCase):
7776
def setUp(self):
7877
self.conf_selector = MockedConfSelector()
79-
self.traj_fmt = 'foo'
8078
self.type_map = []
8179
self.trajs = [Path('traj.foo'), Path('traj.bar')]
8280
self.model_devis = [Path('md.foo'), Path('md.bar')]
@@ -91,7 +89,6 @@ def test(self):
9189
op = SelectConfs()
9290
out = op.execute(OPIO({
9391
'conf_selector': self.conf_selector,
94-
'traj_fmt': self.traj_fmt,
9592
'type_map' : self.type_map,
9693
'trajs' : self.trajs,
9794
'model_devis' : self.model_devis,

0 commit comments

Comments
 (0)