Skip to content

Commit

Permalink
Merge pull request #191 from pyiron/managing_pyiron_jobs
Browse files Browse the repository at this point in the history
Managing pyiron jobs
  • Loading branch information
liamhuber authored Apr 26, 2023
2 parents c7c7d20 + d7ce3b5 commit c360fbf
Show file tree
Hide file tree
Showing 6 changed files with 1,303 additions and 1,082 deletions.
2 changes: 1 addition & 1 deletion ironflow/model/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ class attribute.
valid_job_classes = None
init_inputs = [
NodeInputBP(type_="exec", label="run"),
NodeInputBP(type_="exec", label="remove"),
NodeInputBP(type_="exec", label="reset"),
NodeInputBP(dtype=dtypes.String(default="calc"), label="name"),
]
init_outputs = [
Expand Down
22 changes: 22 additions & 0 deletions ironflow/nodes/pyiron/atomistics_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ class Project_Node(DataNode):
title = "Project"
init_inputs = [
NodeInputBP(dtype=dtypes.String(default="."), label="name"),
NodeInputBP(label="remove", type_="exec"),
NodeInputBP(label="enable_remove", dtype=dtypes.Boolean(default=False)),
NodeInputBP(label="remove_name", dtype=dtypes.String()),
NodeInputBP(label="remove_all", dtype=dtypes.Boolean(default=False)),
NodeInputBP(label="recursive", dtype=dtypes.Boolean(default=True)),
]
init_outputs = [
NodeOutputBP(
Expand All @@ -117,6 +122,23 @@ class Project_Node(DataNode):
]
color = "#aabb44"

def update_event(self, inp=-1):
if inp == 1:
if self.inputs.values.enable_remove:
if self.inputs.values.remove_all:
self.outputs.values.project.remove_jobs(
recursive=self.inputs.values.recursive, silently=True
)
else:
self.outputs.values.project.remove_job(
self.inputs.values.remove_name
)
else:
InfoMsgs.write(
"`enable_remove` must be set to `True` before removing jobs."
)
super().update_event(inp=inp)

def node_function(self, name, **kwargs) -> dict:
return {"project": Project(name)}

Expand Down
1 change: 0 additions & 1 deletion notebooks/bulk_modulus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
" - Observe: Without knowing a-priori which nodes we need to use, we simply follow recommendations to populate our graph\n",
" - Observe: When `Lammps.outputs.engine` is connected to `CalcMurnaghan.inputs.engine`, the only recommendation for `Lammps.inputs.structure` is `BulkStructure` -- but when we disconnect these, Lammps sees both `BulkStructure` _and_ `SlabStructure`! This is because the requirements of the Murnaghan job to be calculated on a bulk structure get propogated upstream by the graph and processed by the ontology reasoner. \n",
"11. Run the `CalcMurnaghan` job\n",
" - Observe: If you use `SHOW` to investigate the `CalcMurnaghan` and `MaterialProperty` node outputs, you'll see that the bulk modulus gets converted from the Murnaghan units of GPa to the ontology's units of MPa.\n",
"12. Select `MaterialProperty` again, and choose `B_prime` from the `property` dropdown.\n",
" - Observe: The `eq_bulk_modulus` output of `CalcMurnaghan` still has a green (valid) output port, but the `source` input port of `MaterialProperty` is now red (invalid) -- this is because the provided ontological type no longer matches the requested property.\n",
"13. Click on the `source` input port again; disconnect it from `eq_bulk_modulus` and reconnect it to the recommended port."
Expand Down
Loading

0 comments on commit c360fbf

Please sign in to comment.