Skip to content

Adding help info to nodes + simplifying run definition #2

Closed
@AlexandreHutton

Description

@AlexandreHutton

Currently, PSCS doesn't relay information about what the node does. For nodes that rely on existing packages, each node will usually call only one function. We should take the docstring from that function and assign it to the node.
Additionally, we could store the function when the node is initialized, then get the docstring in the .store_as_parameters call.

We would be able to remove the run() definition from most nodes and docstrings would be connected to the underlying package. Something like:

class PipelineNode():
    self.function = None
    def run(self):
        data = self.input_data
        self.function(*data, **self.parameters)
        self._terminate(data)

class ExampleNode(PipelineNode):
    self.function = function_to_run
   def __init__(self, params):
        self.store_vars_as_parameters(**vars())
        return

# modify store_vars_as_parameters
self = kwargs["self"]
if self.function is not None and self.__doc__ is not None:
    self.__doc__ = self.function.__doc__
    self._param_doc_ = parse_doc(self.__doc__)   # there are doc parsers; might be able to get parameter-specific help this way for properly-formatted docstring  

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions