Skip to content

Commit 13e7988

Browse files
committed
renaming auxiliary to helpers_state; adding description to the State class, renaming some attributes
1 parent 99f1389 commit 13e7988

File tree

5 files changed

+167
-113
lines changed

5 files changed

+167
-113
lines changed

pydra/engine/core.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from tempfile import mkdtemp
1515

1616
from . import state
17-
from . import auxiliary as aux
17+
from . import helpers_state as hlpst
1818
from .specs import File, BaseSpec, RuntimeSpec, Result, SpecInfo, LazyField, TaskHook
1919
from .helpers import (
2020
make_klass,
@@ -54,11 +54,6 @@ class TaskBase:
5454
_cache_dir = None # Working directory in which to operate
5555
_references = None # List of references for a task
5656

57-
# dj: do we need it??
58-
input_spec = BaseSpec
59-
output_spec = BaseSpec
60-
61-
# TODO: write state should be removed
6257
def __init__(
6358
self,
6459
name: str,
@@ -351,7 +346,7 @@ def split(self, splitter, **kwargs):
351346
self.inputs = dc.replace(self.inputs, **kwargs)
352347
# dj:??, check if I need it
353348
self.state_inputs = kwargs
354-
splitter = aux.change_splitter(splitter, self.name)
349+
splitter = hlpst.add_name_splitter(splitter, self.name)
355350
if self.state:
356351
raise Exception("splitter has been already set")
357352
else:
@@ -376,7 +371,7 @@ def combine(self, combiner):
376371
def get_input_el(self, ind):
377372
"""collecting all inputs required to run the node (for specific state element)"""
378373
if ind is not None:
379-
# TODO: doesnt work properly for more cmplicated wf
374+
# TODO: doesnt work properly for more cmplicated wf (check if still an issue)
380375
state_dict = self.state.states_val[ind]
381376
input_ind = self.state.inputs_ind[ind]
382377
inputs_dict = {}
@@ -417,7 +412,7 @@ def done(self):
417412

418413
def _combined_output(self):
419414
combined_results = []
420-
for (gr, ind_l) in self.state.final_groups_mapping.items():
415+
for (gr, ind_l) in self.state.final_combined_ind_mapping.items():
421416
combined_results.append([])
422417
for ind in ind_l:
423418
result = load_result(self.checksum_states(ind), self.cache_locations)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
""" additional functions used mostly by the State class """
2+
13
import itertools
24
from functools import reduce
35
from copy import deepcopy
@@ -6,8 +8,6 @@
68

79
logger = logging.getLogger("pydra")
810

9-
# dj: might create a new class or move to State
10-
1111

1212
# Function to change user provided splitter to "reverse polish notation" used in State
1313
def splitter2rpn(splitter, other_states=None, state_fields=True):
@@ -337,7 +337,7 @@ def input_shape(in1):
337337
return tuple(shape)
338338

339339

340-
def _splits(splitter_rpn, inputs, inner_inputs=None):
340+
def splits(splitter_rpn, inputs, inner_inputs=None):
341341
""" Process splitter rpn from left to right
342342
"""
343343
stack = []
@@ -456,7 +456,7 @@ def _splits(splitter_rpn, inputs, inner_inputs=None):
456456

457457

458458
# dj: TODO: do I need keys?
459-
def _splits_groups(splitter_rpn, combiner=None, inner_inputs=None):
459+
def splits_groups(splitter_rpn, combiner=None, inner_inputs=None):
460460
""" Process splitter rpn from left to right
461461
"""
462462
if not splitter_rpn:

0 commit comments

Comments
 (0)