Skip to content

Commit

Permalink
Update docstrings for conventional format
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-slac committed Jan 4, 2019
1 parent 61d8e1b commit d02f863
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
20 changes: 12 additions & 8 deletions python/lsst/pipe/base/graphBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, taskName, refs):
# ------------------------


class GraphBuilder:
class GraphBuilder(object):
"""
GraphBuilder class is responsible for building task execution graph from
a Pipeline.
Expand All @@ -94,7 +94,7 @@ class GraphBuilder:
----------
taskFactory : `TaskFactory`
Factory object used to load/instantiate PipelineTasks
registry : :py:class:`daf.butler.Registry`
registry : `~lsst.daf.butler.Registry`
Data butler instance.
skipExisting : `bool`, optional
If ``True`` (default) then Quantum is not created if all its outputs
Expand Down Expand Up @@ -156,23 +156,27 @@ def makeGraph(self, pipeline, originInfo, userQuery):
Parameters
----------
pipeline : :py:class:`Pipeline`
pipeline : `Pipeline`
Pipeline definition, task names/classes and their configs.
originInfo : `DatasetOriginInfo`
originInfo : `~lsst.daf.butler.DatasetOriginInfo`
Object which provides names of the input/output collections.
userQuery : `str`
String which defunes user-defined selection for registry, should be
empty or `None` if there is no restrictions on data selection.
Returns
-------
:py:class:`QuantumGraph` instance.
graph : `QuantumGraph`
Raises
------
`UserExpressionError` is raised when user expression cannot be parsed.
`OutputExistsError` is raised when output datasets already exist.
Other exceptions may be raised by underlying registry classes.
UserExpressionError
Raised when user expression cannot be parsed.
OutputExistsError
Raised when output datasets already exist.
Exception
Other exceptions types may be raised by underlying registry
classes.
"""

# make sure all task classes are loaded
Expand Down
33 changes: 21 additions & 12 deletions python/lsst/pipe/base/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,18 @@ class TaskDef:
Attributes
----------
taskName : str
PipelineTask class name, currently it is not specified whether this
taskName : `str`
`PipelineTask` class name, currently it is not specified whether this
is a fully-qualified name or partial name (e.g. ``module.TaskClass``).
Framework should be prepared to handle all cases.
config : `pex_config.Config`
config : `lsst.pex.config.Config`
Instance of the configuration class corresponding to this task class,
usually with all overrides applied.
taskClass : type or None
PipelineTask class object, can be None. If None then framework will
have to locate and load class.
label : str, optional
PipelineTask class object, can be None. If None then framework will
have to locate and load class.
taskClass : `type` or ``None``
`PipelineTask` class object, can be ``None``. If ``None`` then
framework will have to locate and load class.
label : `str`, optional
Task label, usually a short string unique in a pipeline.
"""
def __init__(self, taskName, config, taskClass=None, label=""):
self.taskName = taskName
Expand All @@ -80,7 +79,7 @@ def __str__(self):


class Pipeline(list):
"""Pipeline is a sequence of TaskDef objects.
"""Pipeline is a sequence of `TaskDef` objects.
Pipeline is given as one of the inputs to a supervising framework
which builds execution graph out of it. Pipeline contains a sequence
Expand All @@ -89,7 +88,7 @@ class Pipeline(list):
Main purpose of this class is to provide a mechanism to pass pipeline
definition from users to supervising framework. That mechanism is
implemented using simple serialization and de-serialization via
pickle. Note that pipeline serialization is not guaranteed to be
`pickle`. Note that pipeline serialization is not guaranteed to be
compatible between different versions or releases.
In current implementation Pipeline is a list (it inherits from `list`)
Expand All @@ -107,7 +106,17 @@ def __init__(self, iterable=None):
list.__init__(self, iterable or [])

def labelIndex(self, label):
"""Return task index given its label, returns -1 if label is not found
"""Return task index given its label.
Parameters
----------
label : `str`
Task label.
Returns
-------
index : `int`
Task index, or -1 if label is not found.
"""
for idx, taskDef in enumerate(self):
if taskDef.label == label:
Expand Down
7 changes: 4 additions & 3 deletions python/lsst/pipe/base/pipelineBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PipelineBuilder:
"""PipelineBuilder class is responsible for building task pipeline.
The class provides a set of methods to manipulate pipeline by adding,
deleting, re-ordering tasks in pipeline and chaning their labels or
deleting, re-ordering tasks in pipeline and changing their labels or
configuration.
Parameters
Expand Down Expand Up @@ -108,7 +108,7 @@ def addTask(self, taskName, label=None):
package and module, or just a class name to be searched in
known packages and modules.
label : `str`, optional
Label for new task, if `None` the n task class name is used as
Label for new task, if `None` then task class name is used as
label.
"""
# load task class, will throw on errors
Expand Down Expand Up @@ -180,7 +180,8 @@ def configOverride(self, label, value):
label : `str`
Label of the task.
value : `str`
String in the form "param=value".
String in the form ``"param=value"`` or ``"parm.subpar=value"``,
``value`` can be a Python constant or a list of constants.
"""
idx = self._pipeline.labelIndex(label)
if idx < 0:
Expand Down

0 comments on commit d02f863

Please sign in to comment.