neuralset.base.Chain¶
- class neuralset.base.Chain(*, infra: Backend | None = None, steps: list[Step] | OrderedDict[str, Step])[source][source]¶
A sequence of processing steps executed in order.
A
Chaingroups multipleStepobjects (such asStudyandEventsTransform) into a single cohesive pipeline. Because aChainis itself aStep, it can be nested inside other chains or used anywhere aStepis expected. When you call.run(), it passes the output of each step as the input to the next.- Parameters:
steps (list of dict or dict of str to dict) – The ordered sequence of steps to execute. Since this is a pydantic config, it is strongly recommended to pass a list of dictionaries rather than instantiated objects (these dictionaries are coerced automatically). If a dict of dicts is provided, the keys act as step names.
infra (dict or exca.Infra, optional) – A pydantic config for caching and execution infrastructure inherited from
Step. If provided, it determines how the final output of the chain is cached (e.g. using theCachedbackend) or executed remotely (e.g. viaSlurm).
Examples
chain = ns.Chain(steps=[ {"name": "MyStudy", "path": "/data", "infra": {"backend": "Cached", "folder": "/cache"}}, {"name": "QueryEvents", "query": "timeline_index < 5"}, ]) events = chain.run()