Skip to content

Commit

Permalink
key added to Step for user reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Wang committed Feb 8, 2022
1 parent 25822a7 commit 90dc8b4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
8 changes: 8 additions & 0 deletions dpgen2/flow/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def block_cl(
name + '-prep-run-dp-train',
template = prep_run_dp_train_op,
parameters={
"block_id" : block_steps.inputs.parameters['block_id'],
"train_config" : block_steps.inputs.parameters['train_config'],
"numb_models": block_steps.inputs.parameters['numb_models'],
"template_script": block_steps.inputs.parameters['template_script'],
Expand All @@ -81,19 +82,22 @@ def block_cl(
"init_data" : block_steps.inputs.artifacts['init_data'],
"iter_data" : block_steps.inputs.artifacts['iter_data'],
},
key = "%s-prep-run-train" % block_steps.inputs.parameters["block_id"],
)
block_steps.add(prep_run_dp_train)

prep_run_lmp = Step(
name = name + '-prep-run-lmp',
template = prep_run_lmp_op,
parameters={
"block_id" : block_steps.inputs.parameters['block_id'],
"lmp_task_grp": block_steps.inputs.parameters['lmp_task_grp'],
"lmp_config": block_steps.inputs.parameters['lmp_config'],
},
artifacts={
"models" : prep_run_dp_train.outputs.artifacts['models'],
},
key = "%s-prep-run-lmp" % block_steps.inputs.parameters["block_id"],
)
block_steps.add(prep_run_lmp)

Expand All @@ -116,19 +120,22 @@ def block_cl(
"trajs" : prep_run_lmp.outputs.artifacts['trajs'],
"model_devis" : prep_run_lmp.outputs.artifacts['model_devis'],
},
key = "%s-select-conf" % block_steps.inputs.parameters["block_id"],
)
block_steps.add(select_confs)

prep_run_fp = Step(
name = name + '-prep-run-fp',
template = prep_run_fp_op,
parameters={
"block_id" : block_steps.inputs.parameters['block_id'],
"inputs": block_steps.inputs.parameters['fp_inputs'],
"fp_config": block_steps.inputs.parameters['fp_config'],
},
artifacts={
"confs" : select_confs.outputs.artifacts['confs'],
},
key = "%s-prep-run-fp" % block_steps.inputs.parameters["block_id"],
)
block_steps.add(prep_run_fp)

Expand All @@ -149,6 +156,7 @@ def block_cl(
"iter_data" : block_steps.inputs.artifacts['iter_data'],
"labeled_data" : prep_run_fp.outputs.artifacts['labeled_data'],
},
key = "%s-collect-data" % block_steps.inputs.parameters["block_id"],
)
block_steps.add(collect_data)

Expand Down
7 changes: 5 additions & 2 deletions dpgen2/flow/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from dpgen2.exploration.scheduler import ExplorationScheduler
from dpgen2.exploration.report import ExplorationReport
from dpgen2.exploration.task import ExplorationTaskGroup
from dpgen2.exploration.conf_selector import ConfSelector
from dpgen2.exploration.selector import ConfSelector
from dpgen2.flow.block import block_cl

class SchedulerWrapper(OP):
Expand Down Expand Up @@ -162,6 +162,7 @@ def loop (
"init_data": steps.inputs.artifacts["init_data"],
"iter_data": steps.inputs.artifacts["iter_data"],
},
key = "%s-block" % steps.inputs.parameters["block_id"],
)
steps.add(block_step)

Expand All @@ -179,6 +180,7 @@ def loop (
artifacts={
"trajs" : block_step.outputs.artifacts['trajs'],
},
key = "%s-scheduler" % steps.inputs.parameters["block_id"],
)
steps.add(scheduler_step)

Expand All @@ -194,6 +196,7 @@ def loop (
},
artifacts={
},
key = "%s-id" % steps.inputs.parameters["block_id"],
)
steps.add(id_step)

Expand Down Expand Up @@ -321,8 +324,8 @@ def dpgen(
"template_script" : steps.inputs.parameters['template_script'],
"train_config" : steps.inputs.parameters['train_config'],
"lmp_task_grp" : scheduler_step.outputs.parameters['lmp_task_grp'],
"lmp_config" : steps.inputs.parameters['lmp_config'],
"conf_selector" : scheduler_step.outputs.parameters['conf_selector'],
"lmp_config" : steps.inputs.parameters['lmp_config'],
"fp_inputs" : steps.inputs.parameters['fp_inputs'],
"fp_config" : steps.inputs.parameters['fp_config'],
"exploration_scheduler" : scheduler_step.outputs.parameters['exploration_scheduler'],
Expand Down
3 changes: 3 additions & 0 deletions dpgen2/flow/prep_run_dp_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def prep_run_dp_train(
name=name,
inputs=Inputs(
parameters={
"block_id" : InputParameter(type=str, value=""),
"numb_models": InputParameter(type=int),
"template_script" : InputParameter(),
"train_config" : InputParameter(),
Expand Down Expand Up @@ -72,6 +73,7 @@ def prep_run_dp_train(
},
artifacts={
},
key = "%s-prep-train" % train_steps.inputs.parameters["block_id"],
)
train_steps.add(prep_train)

Expand Down Expand Up @@ -99,6 +101,7 @@ def prep_run_dp_train(
"iter_data": train_steps.inputs.artifacts['iter_data'],
},
with_param=argo_range(train_steps.inputs.parameters["numb_models"]),
key = "%s-run-train" % train_steps.inputs.parameters["block_id"],
)
train_steps.add(run_train)

Expand Down
3 changes: 3 additions & 0 deletions dpgen2/flow/prep_run_fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def prep_run_fp(
name=name,
inputs=Inputs(
parameters={
"block_id" : InputParameter(type=str, value=""),
"inputs": InputParameter(),
"fp_config" : InputParameter(),
},
Expand Down Expand Up @@ -70,6 +71,7 @@ def prep_run_fp(
artifacts={
"confs" : prep_run_steps.inputs.artifacts['confs'],
},
key = "%s-prep-fp" % prep_run_steps.inputs.parameters["block_id"],
)
prep_run_steps.add(prep_fp)

Expand All @@ -94,6 +96,7 @@ def prep_run_fp(
'task_path' : prep_fp.outputs.artifacts['task_paths'],
},
with_param=argo_range(argo_len(prep_fp.outputs.parameters["task_names"])),
key = "%s-run-fp" % prep_run_steps.inputs.parameters["block_id"],
)
prep_run_steps.add(run_fp)

Expand Down
3 changes: 3 additions & 0 deletions dpgen2/flow/prep_run_lmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def prep_run_lmp(
name=name,
inputs=Inputs(
parameters={
"block_id" : InputParameter(type=str, value=""),
"lmp_task_grp": InputParameter(type=int),
"lmp_config" : InputParameter()
},
Expand Down Expand Up @@ -70,6 +71,7 @@ def prep_run_lmp(
},
artifacts={
},
key = "%s-prep-lmp" % prep_run_steps.inputs.parameters["block_id"],
)
prep_run_steps.add(prep_lmp)

Expand All @@ -96,6 +98,7 @@ def prep_run_lmp(
},
# with_sequence=argo_sequence(argo_len(prep_lmp.outputs.parameters["task_names"])),
with_param=argo_range(argo_len(prep_lmp.outputs.parameters["task_names"])),
key = "%s-run-lmp" % prep_run_steps.inputs.parameters["block_id"],
)
prep_run_steps.add(run_lmp)

Expand Down
8 changes: 3 additions & 5 deletions tests/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@
from dpgen2.flow.block import block_cl
from dpgen2.exploration.task import ExplorationTask, ExplorationTaskGroup
from dpgen2.fp.vasp import VaspInputs
from dpgen2.exploration.stage import ExplorationStage
from dpgen2.exploration.report import ExplorationReport
from dpgen2.flow.loop import dpgen, loop
from dpgen2.exploration.task import ExplorationTaskGroup
from dpgen2.exploration.trust_level import TrustLevel
from dpgen2.exploration.conf_selector import TrustLevelConfSelector
from dpgen2.exploration.report import ExplorationReport
from dpgen2.exploration.task import ExplorationTaskGroup, ExplorationStage
from dpgen2.exploration.selector import TrustLevelConfSelector, TrustLevel

from dpgen2.constants import (
train_task_pattern,
Expand Down

0 comments on commit 90dc8b4

Please sign in to comment.