Skip to content

Commit c5da03b

Browse files
committed
debugging node state operations
1 parent 1cc4074 commit c5da03b

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

pydra/engine/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ def _check_for_hash_changes(self):
544544
details = ""
545545
for changed in hash_changes:
546546
field = getattr(attr.fields(type(self.definition)), changed)
547+
hash_function(getattr(self.definition, changed))
547548
val = getattr(self.definition, changed)
548549
field_type = type(val)
549550
if inspect.isclass(field.type) and issubclass(field.type, FileSet):
@@ -570,7 +571,7 @@ def _check_for_hash_changes(self):
570571
if hash_changes:
571572
raise RuntimeError(
572573
f"Input field hashes have changed during the execution of the "
573-
f"'{self.name}' {type(self).__name__}.\n\n{details}"
574+
f"'{self.name}' task of {type(self)} type.\n\n{details}"
574575
)
575576
logger.debug(
576577
"Input values and hashes for '%s' %s node:\n%s\n%s",

pydra/engine/node.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class Node(ty.Generic[OutputType]):
4545
init=False, default=None, eq=False, hash=False, repr=False
4646
)
4747
_state: State | None = attrs.field(init=False, default=NOT_SET)
48-
_cont_dim: dict[str, int] | None = attrs.field(
49-
init=False, default=None
50-
) # QUESTION: should this be included in the state?
51-
_inner_cont_dim: dict[str, int] = attrs.field(
52-
init=False, factory=dict
53-
) # QUESTION: should this be included in the state?
48+
# _cont_dim: dict[str, int] | None = attrs.field(
49+
# init=False, default=None
50+
# ) # QUESTION: should this be included in the state?
51+
# _inner_cont_dim: dict[str, int] = attrs.field(
52+
# init=False, factory=dict
53+
# ) # QUESTION: should this be included in the state?
5454

5555
def __attrs_post_init__(self):
5656
self._set_state()
@@ -179,16 +179,20 @@ def _check_if_outputs_have_been_used(self, msg):
179179

180180
def _set_state(self) -> None:
181181
# Add node name to state's splitter, combiner and cont_dim loaded from the def
182-
splitter = self._definition._splitter
183-
combiner = self._definition._combiner
182+
splitter = deepcopy(
183+
self._definition._splitter
184+
) # these can be modified by the state
185+
combiner = deepcopy(
186+
self._definition._combiner
187+
) # these can be modified by the state
184188
if splitter:
185189
splitter = hlpst.add_name_splitter(splitter, self.name)
186190
if combiner:
187191
combiner = hlpst.add_name_combiner(combiner, self.name)
188192
if self._definition._cont_dim:
189-
self._cont_dim = {}
193+
cont_dim = {}
190194
for key, val in self._definition._cont_dim.items():
191-
self._cont_dim[f"{self.name}.{key}"] = val
195+
cont_dim[f"{self.name}.{key}"] = val
192196
other_states = self._get_upstream_states()
193197
if splitter or combiner or other_states:
194198
self._state = State(
@@ -197,6 +201,7 @@ def _set_state(self) -> None:
197201
splitter=splitter,
198202
other_states=other_states,
199203
combiner=combiner,
204+
cont_dim=cont_dim,
200205
)
201206
if combiner:
202207
if not_split := [

pydra/engine/submitter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def __call__(
215215
definition=task_def,
216216
splitter=deepcopy(task_def._splitter),
217217
combiner=deepcopy(task_def._combiner),
218+
cont_dim=deepcopy(task_def._cont_dim),
218219
)
219220

220221
def wrap_type(tp):

0 commit comments

Comments
 (0)