Skip to content

Commit

Permalink
remove old workaround code because we are trying to fix rail changes
Browse files Browse the repository at this point in the history
  • Loading branch information
joezuntz committed Jul 11, 2024
1 parent 06544c7 commit 2809a08
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
20 changes: 2 additions & 18 deletions ceci/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,7 @@ def build_stage_object(self, args):
self.stage_class = PipelineStage.get_stage(
self.class_name, self.module_name
)
# EAC. Ideally we would just pass the aliases into the c'tor of self.stage_class(),
# but that would requiring changing the signature of every sub-class, so we do this
# instead. At some point we might want to migrate to doing it the better way
try:
self.stage_obj = self.stage_class(args, aliases=self.aliases)
except TypeError:
self.stage_obj = self.stage_class(args)
self.stage_obj._aliases.update(**self.aliases)
self.stage_obj._io_checked = False
self.stage_obj.check_io()
self.stage_obj = self.stage_class(args, aliases=self.aliases)
return self.stage_obj

def generate_full_command(self, inputs, outputs, config):
Expand Down Expand Up @@ -678,14 +669,7 @@ def build_stage(self, stage_class, **kwargs):
comm = kwcopy.pop("comm", None)
kwcopy.update(**self.pipeline_files)

try:
stage = stage_class(kwcopy, comm=comm, aliases=aliases)
except TypeError as error:
warnings.warn("Pipeline stage subclasses should accept aliases as a keyword argument.")
stage = stage_class(kwcopy, comm=comm)
stage._aliases.update(**aliases)
stage._io_checked = False
stage.check_io()
stage = stage_class(kwcopy, comm=comm, aliases=aliases)
return self.add_stage(stage)

def remove_stage(self, name):
Expand Down
14 changes: 3 additions & 11 deletions ceci/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def __init__(self, args, comm=None, aliases=None):
if comm is not None:
self.setup_mpi(comm)

self.check_io()


@classmethod
def make_stage(cls, **kwargs):
Expand All @@ -118,17 +120,7 @@ def make_stage(cls, **kwargs):
for output_ in cls.outputs: # pylint: disable=no-member
outtag = output_[0]
aliases[outtag] = f"{outtag}_{name}"
# EAC. Ideally we would just pass the aliases into the construction call
# but that would requiring changing the signature of every sub-class, so we do this
# instead. At some point we might want to migrate to doing it the better way
try:
stage = cls(kwcopy, comm=comm, aliases=aliases)
except TypeError as error:
warnings.warn("Pipeline stage subclasses should accept aliases as a keyword argument")
stage = cls(kwcopy, comm=comm)
stage._aliases.update(**aliases)
stage._io_checked = False
stage.check_io()
stage = cls(kwcopy, comm=comm, aliases=aliases)
return stage

def get_aliases(self):
Expand Down
1 change: 0 additions & 1 deletion tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ def test_inter_pipe():

if __name__ == "__main__":
test_config()
test_interactive()
2 changes: 0 additions & 2 deletions tests/test_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,6 @@ class LimaSerial(LimaParallel):
assert LimaSerial.parse_command_line(["LimaSerial", "--mpi"]).mpi


# could add more tests here for constructor, but the regression tests here and in TXPipe are
# pretty thorough.

if __name__ == "__main__":
test_construct()
Expand Down

0 comments on commit 2809a08

Please sign in to comment.