Skip to content

Commit

Permalink
Apply code style
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Mar 21, 2024
1 parent 33c373f commit f57fb1c
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 48 deletions.
20 changes: 10 additions & 10 deletions src/miv_simulator/interface/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ def __call__(self):

def on_write_meta_data(self):
return MPI.COMM_WORLD.Get_rank() == 0

def compute_context(self):
context = super().compute_context()
del context['config']['filepath']
del context['config']['forest_filepath']
del context['config']['io_size']
del context['config']['chunk_size']
del context['config']['value_chunk_size']
del context['config']['cache_size']
del context['config']['write_size']
del context['config']['ranks']
context['predicate']['uses'] = sorted([u.hash for u in self.uses])
del context["config"]["filepath"]
del context["config"]["forest_filepath"]
del context["config"]["io_size"]
del context["config"]["chunk_size"]
del context["config"]["value_chunk_size"]
del context["config"]["cache_size"]
del context["config"]["write_size"]
del context["config"]["ranks"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
16 changes: 8 additions & 8 deletions src/miv_simulator/interface/distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def __call__(self):

def on_write_meta_data(self):
return MPI.COMM_WORLD.Get_rank() == 0

def compute_context(self):
context = super().compute_context()
del context['config']['filepath']
del context['config']['io_size']
del context['config']['chunk_size']
del context['config']['value_chunk_size']
del context['config']['cache_size']
del context['config']['ranks']
context['predicate']['uses'] = sorted([u.hash for u in self.uses])
del context["config"]["filepath"]
del context["config"]["io_size"]
del context["config"]["chunk_size"]
del context["config"]["value_chunk_size"]
del context["config"]["cache_size"]
del context["config"]["ranks"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
4 changes: 2 additions & 2 deletions src/miv_simulator/interface/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ def launch(self):

def compute_context(self):
context = super().compute_context()
del context['config']
return context
del context["config"]
return context
14 changes: 7 additions & 7 deletions src/miv_simulator/interface/network_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ def generate_connections(self, version=None, uses=None):

def compute_context(self):
context = super().compute_context()
del context['config']['filepath']
del context['config']['io_size']
del context['config']['chunk_size']
del context['config']['value_chunk_size']
del context['config']['ranks']
context['predicate']['uses'] = sorted([u.hash for u in self.uses])
return context
del context["config"]["filepath"]
del context["config"]["io_size"]
del context["config"]["chunk_size"]
del context["config"]["value_chunk_size"]
del context["config"]["ranks"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
4 changes: 2 additions & 2 deletions src/miv_simulator/interface/neuroh5_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def files(self) -> Dict[str, str]:
"cells": self.graph.cells_filepath,
"connections": self.graph.connections_filepath,
}

def compute_context(self):
context = super().compute_context()
context['predicate']['uses'] = sorted([u.hash for u in self.uses])
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
9 changes: 6 additions & 3 deletions src/miv_simulator/interface/synapse_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pydantic import BaseModel, Field, ConfigDict
from machinable.utils import file_hash


class GenerateSynapseForest(Component):
class Config(BaseModel):
model_config = ConfigDict(extra="forbid")
Expand Down Expand Up @@ -32,7 +33,9 @@ def __call__(self) -> None:
def compute_context(self):
# remove filepath in favor of uses
context = super().compute_context()
del context['config']['filepath']
context['config']['morphology'] = file_hash(context['config']['morphology'])
context['predicate']['uses'] = sorted([u.hash for u in self.uses])
del context["config"]["filepath"]
context["config"]["morphology"] = file_hash(
context["config"]["morphology"]
)
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
18 changes: 9 additions & 9 deletions src/miv_simulator/interface/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def on_write_meta_data(self):

def compute_context(self):
context = super().compute_context()
del context['config']['forest_filepath']
del context['config']['template_path']
del context['config']['mechanisms_path']
del context['config']['io_size']
del context['config']['write_size']
del context['config']['chunk_size']
del context['config']['value_chunk_size']
del context['config']['ranks']
context['predicate']['uses'] = sorted([u.hash for u in self.uses])
del context["config"]["forest_filepath"]
del context["config"]["template_path"]
del context["config"]["mechanisms_path"]
del context["config"]["io_size"]
del context["config"]["write_size"]
del context["config"]["chunk_size"]
del context["config"]["value_chunk_size"]
del context["config"]["ranks"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
3 changes: 2 additions & 1 deletion tests/_machinable/project.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from machinable import Project


class TestEnv(Project):
def on_resolve_remotes(self):
return {
"mpi": "url+https://raw.githubusercontent.com/machinable-org/machinable/2670e9626eb548f6ce2301923be1f49642086d8c/docs/examples/mpi-execution/mpi.py",
}
}
10 changes: 4 additions & 6 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def test_interface(tmp_path):

source = os.environ["MIV_SIMULATOR_TEST_INTERFACE_SRC"]
wd = os.path.dirname(__file__)

debug = True
storage_directory = str(tmp_path / 'storage')
storage_directory = str(tmp_path / "storage")
if debug:
storage_directory = f"{wd}/_machinable/storage"

with get("machinable.index", storage_directory), get(
"machinable.project", wd
):
Expand All @@ -31,9 +31,7 @@ def test_interface(tmp_path):
"morphology_path": f"{source}/morphology",
},
).launch()

for component in run.executables:
print(component)
assert component.cached()


0 comments on commit f57fb1c

Please sign in to comment.