Skip to content

Commit

Permalink
Remove traj_fmt (#110)
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
wanghan-iapcm and Han Wang committed Dec 31, 2022
1 parent 5465850 commit 414c7b3
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 14 deletions.
4 changes: 3 additions & 1 deletion dpgen2/entrypoint/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def watch(

finished_keys = None

while wf.query_status() in ["Pending", "Running"]:
while wf.query_status() in ["Pending", "Running", "Failed", "Error"]:
finished_keys = update_finished_steps(
wf,
finished_keys,
Expand All @@ -77,6 +77,8 @@ def watch(
prefix=prefix,
chk_pnt=chk_pnt,
)
if wf.query_status() in ["Failed", "Error"]:
break
time.sleep(frequency)

status = wf.query_status()
Expand Down
2 changes: 0 additions & 2 deletions dpgen2/exploration/selector/conf_selector_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def select (
Format: each line has 7 numbers they are used as
# frame_id md_v_max md_v_min md_v_mean md_f_max md_f_min md_f_mean
where `md` stands for model deviation, v for virial and f for force
traj_fmt : str
Format of the trajectory, by default it is the dump file of LAMMPS
type_map : List[str]
The `type_map` of the systems
Expand Down
4 changes: 0 additions & 4 deletions dpgen2/op/select_confs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SelectConfs(OP):
def get_input_sign(cls):
return OPIOSign({
"conf_selector": ConfSelector,
"traj_fmt": str,
"type_map": List[str],

"trajs": Artifact(List[Path]),
Expand Down Expand Up @@ -48,7 +47,6 @@ def execute(
Input dict with components:
- `conf_selector`: (`ConfSelector`) Configuration selector.
- `traj_fmt`: (`str`) The format of trajectory.
- `type_map`: (`List[str]`) The type map.
- `trajs`: (`Artifact(List[Path])`) The trajectories generated in the exploration.
- `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.
Expand All @@ -63,7 +61,6 @@ def execute(
"""

conf_selector = ip['conf_selector']
traj_fmt = ip['traj_fmt']
type_map = ip['type_map']

trajs = ip['trajs']
Expand All @@ -72,7 +69,6 @@ def execute(
confs, report = conf_selector.select(
trajs,
model_devis,
traj_fmt = traj_fmt,
type_map = type_map,
)

Expand Down
1 change: 0 additions & 1 deletion dpgen2/superop/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def _block_cl(
parameters={
"conf_selector": block_steps.inputs.parameters['conf_selector'],
"type_map": block_steps.inputs.parameters["type_map"],
"traj_fmt": 'lammps/dump',
},
artifacts={
"trajs" : prep_run_lmp.outputs.artifacts['trajs'],
Expand Down
3 changes: 0 additions & 3 deletions tests/mocked_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ def execute(
name = Path(name)
for ii in labeled_data:
iiname = ii.name
print('copy-------------------', ii, name/iiname)

raise FatalError

Expand Down Expand Up @@ -607,7 +606,6 @@ def execute(

for ii in labeled_data:
iiname = ii.name
print('copy-------------------', ii, name/iiname)
shutil.copytree(ii, name/iiname)
fc = (name/iiname/'data').read_text()
fc = "restart\n" + fc
Expand Down Expand Up @@ -728,7 +726,6 @@ def select (
self,
trajs : List[Path],
model_devis : List[Path],
traj_fmt : str = 'deepmd/npy',
type_map : List[str] = None,
) -> Tuple[List[ Path ], TrustLevel] :
confs = []
Expand Down
3 changes: 0 additions & 3 deletions tests/test_select_confs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test(self):
op = MockedSelectConfs()
out = op.execute(OPIO({
'conf_selector': self.conf_selector,
'traj_fmt': self.traj_fmt,
'type_map' : self.type_map,
'trajs' : self.trajs,
'model_devis' : self.model_devis,
Expand All @@ -76,7 +75,6 @@ def test(self):
class TestSelectConfs(unittest.TestCase):
def setUp(self):
self.conf_selector = MockedConfSelector()
self.traj_fmt = 'foo'
self.type_map = []
self.trajs = [Path('traj.foo'), Path('traj.bar')]
self.model_devis = [Path('md.foo'), Path('md.bar')]
Expand All @@ -91,7 +89,6 @@ def test(self):
op = SelectConfs()
out = op.execute(OPIO({
'conf_selector': self.conf_selector,
'traj_fmt': self.traj_fmt,
'type_map' : self.type_map,
'trajs' : self.trajs,
'model_devis' : self.model_devis,
Expand Down

0 comments on commit 414c7b3

Please sign in to comment.