Skip to content

Commit d895e5f

Browse files
committed
support process_def params as config items
1 parent ee67d22 commit d895e5f

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from registry import spatio_flux_library
1+
from simple_process_bigraph_runtime.registry import spatio_flux_library

src/simple_process_bigraph_runtime/dsl_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
import rich
2+
33
from process_bigraph_lang.antlr_dsl.generate import bind_model
44
from process_bigraph_lang.dsl import generate
55
from process_bigraph_lang.dsl.model import (

src/simple_process_bigraph_runtime/generation/composite_generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ def process_composite(model: Model, assembler: Vivarium):
6363
if 0 == len(out_binding):
6464
for token in map_key.split("::"):
6565
out_binding.append(token)
66+
config = {p.name: p.default.val for p in process_def_actual.params}
6667
assembler.add_process(
6768
name=process.name,
6869
process_id=".".join(process_def_actual.python_path.path),
69-
# config=config,
70+
config=config,
7071
inputs=input_bindings,
7172
outputs=output_bindings,
7273
)

src/simple_process_bigraph_runtime/registry/toy_library.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def inputs(self):
6060
}
6161

6262
def update(self, state):
63-
with open(os.path.expanduser("~/Documents/pb_output_dir/output_value.txt"), "w+") as f:
63+
with open(os.path.expanduser(self.config["output_file_path"]), "w+") as f:
6464
f.write(str(state["result"]))
6565

6666
class SaveFloatToFileRepeatedly(Process):
@@ -71,7 +71,7 @@ def inputs(self):
7171

7272
def update(self, state, interval):
7373
value = str(state["result"])
74-
with open(os.path.expanduser("~/Documents/pb_output_dir/output_value.txt"), "w+") as f:
74+
with open(os.path.expanduser(self.config["output_file_path"]), "w+") as f:
7575
f.write(value)
7676

7777
class AddComplexNumbers(Step):

0 commit comments

Comments
 (0)