Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions concore_cli/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def _write_docker_compose(output_path, console, zmq_mode=False):
compose_lines.append("volumes:")
for v in sorted(named_volumes):
compose_lines.append(f" {v}:")
compose_lines.append(f" name: {_yaml_quote(v)}")

compose_lines.append("")
compose_lines.append("networks:")
Expand Down
2 changes: 1 addition & 1 deletion concoredocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
simtime = 0

def _port_path(base, port_num):
return os.path.join(base, str(port_num))
return base + str(port_num)

concore_params_file = os.path.join(_port_path(inpath, 1), "concore.params")
concore_maxtime_file = os.path.join(_port_path(inpath, 1), "concore.maxtime")
Expand Down
53 changes: 53 additions & 0 deletions demo/sampleJ.graphml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd" xmlns:y="http://www.yworks.com/xml/graphml">
<key for="node" id="d6" yfiles.type="nodegraphics"/>
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="1638389982514" projectName="sample">
<node id="23fe819b-a16c-43cb-9d94-f3b53d06985f">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="50" width="132" x="100" y="100"/>
<y:Fill color="#ffcc00" opacity="1"/>
<y:BorderStyle color="#000" width="1"/>
<y:NodeLabel>CZ:controller_jl.jl</y:NodeLabel>
<y:Shape type="rectangle"/>
</y:ShapeNode>
</data>
</node>
<node id="9c5e14c8-1f5c-420e-a72d-46b2efa244a6">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="50" width="100" x="99" y="262"/>
<y:Fill color="#ffcc00" opacity="1"/>
<y:BorderStyle color="#000" width="1"/>
<y:NodeLabel>PZ:pm.py</y:NodeLabel>
<y:Shape type="rectangle"/>
</y:ShapeNode>
</data>
</node>
<edge id="0" source="23fe819b-a16c-43cb-9d94-f3b53d06985f" target="9c5e14c8-1f5c-420e-a72d-46b2efa244a6">
<data key="d10">
<y:GenericEdge configuration="com.yworks.bpmn.Connection">
<y:LineStyle color="#f44336" width="1" type="solid"/>
<y:Arrows source="none" target="delta"/>
<y:EdgeLabel>CU</y:EdgeLabel>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="99.42283950617283" y="193.5"/>
</y:Path>
</y:GenericEdge>
</data>
</edge>
<edge id="1" source="9c5e14c8-1f5c-420e-a72d-46b2efa244a6" target="23fe819b-a16c-43cb-9d94-f3b53d06985f">
<data key="d10">
<y:GenericEdge configuration="com.yworks.bpmn.Connection">
<y:LineStyle color="#827717" width="1" type="solid"/>
<y:Arrows source="none" target="delta"/>
<y:EdgeLabel>PYM</y:EdgeLabel>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="122.24371946735148" y="167.84209541286452"/>
</y:Path>
</y:GenericEdge>
</data>
</edge>
</graph>
</graphml>
7 changes: 7 additions & 0 deletions tests/test_compose_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def test_compose_has_network_section(tmp_path):
assert "networks:" in content


def test_compose_preserves_named_volume(tmp_path):
(tmp_path / "run").write_text("docker run --name node1 -v CU:/out1 concore/py &")
path = _write_docker_compose(tmp_path, Console(quiet=True))
content = path.read_text()
assert " CU:\n name: 'CU'" in content


def test_compose_depends_on_second_service(tmp_path):
_fake_run_script(
tmp_path,
Expand Down
28 changes: 20 additions & 8 deletions tests/test_concoredocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def test_returns_default_for_bad_syntax(self, temp_dir):
assert result == "fallback"


class TestDockerPaths:
def test_port_path_matches_docker_mounts(self):
from concoredocker import _port_path

assert _port_path("/in", 1) == "/in1"
assert _port_path("/out", 2) == "/out2"


class TestUnchanged:
def test_returns_true_when_unchanged(self):
import concoredocker
Expand Down Expand Up @@ -89,9 +97,10 @@ def test_writes_list_with_simtime(self, temp_dir):
import concoredocker

old_outpath = concoredocker.outpath
outdir = os.path.join(temp_dir, "1")
outpath = os.path.join(temp_dir, "out")
outdir = outpath + "1"
os.makedirs(outdir)
concoredocker.outpath = temp_dir
concoredocker.outpath = outpath
concoredocker.simtime = 5.0

concoredocker.write(1, "testfile", [1.0, 2.0], delta=0)
Expand All @@ -105,9 +114,10 @@ def test_writes_with_delta(self, temp_dir):
import concoredocker

old_outpath = concoredocker.outpath
outdir = os.path.join(temp_dir, "1")
outpath = os.path.join(temp_dir, "out")
outdir = outpath + "1"
os.makedirs(outdir)
concoredocker.outpath = temp_dir
concoredocker.outpath = outpath
concoredocker.simtime = 10.0

concoredocker.write(1, "testfile", [3.0], delta=2)
Expand All @@ -126,9 +136,10 @@ def test_reads_and_parses_data(self, temp_dir):

old_inpath = concoredocker.inpath
old_delay = concoredocker.delay
indir = os.path.join(temp_dir, "1")
inpath = os.path.join(temp_dir, "in")
indir = inpath + "1"
os.makedirs(indir)
concoredocker.inpath = temp_dir
concoredocker.inpath = inpath
concoredocker.delay = 0.001

with open(os.path.join(indir, "data"), "w") as f:
Expand All @@ -149,9 +160,10 @@ def test_returns_default_when_file_missing(self, temp_dir):

old_inpath = concoredocker.inpath
old_delay = concoredocker.delay
indir = os.path.join(temp_dir, "1")
inpath = os.path.join(temp_dir, "in")
indir = inpath + "1"
os.makedirs(indir)
concoredocker.inpath = temp_dir
concoredocker.inpath = inpath
concoredocker.delay = 0.001

concoredocker.s = ""
Expand Down
Loading