Skip to content

Commit 825795d

Browse files
authored
Merge pull request #450 from Carreau/doc-1
DOC: reformat docstrings + misc fixes
2 parents 0ac0295 + 555304d commit 825795d

File tree

13 files changed

+79
-156
lines changed

13 files changed

+79
-156
lines changed

ipyparallel/apps/ipclusterapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def find_launcher_class(clsname, kind):
104104
"""Return a launcher for a given clsname and kind.
105105
106106
Parameters
107-
==========
107+
----------
108108
clsname : str
109109
The full name of the launcher class, either with or without the
110110
module path, or an abbreviation (MPI, SSH, SGE, PBS, LSF, HTCondor

ipyparallel/client/asyncresult.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ def timedelta(self, start, end, start_key=min, end_key=max):
447447
448448
Parameters
449449
----------
450-
451450
start : one or more datetime objects (e.g. ar.submitted)
452451
end : one or more datetime objects (e.g. ar.received)
453452
start_key : callable
@@ -459,7 +458,6 @@ def timedelta(self, start, end, start_key=min, end_key=max):
459458
460459
Returns
461460
-------
462-
463461
dt : float
464462
The time elapsed (in seconds) between the two selected timestamps.
465463
"""
@@ -579,7 +577,6 @@ def display_outputs(self, groupby="type"):
579577
580578
Parameters
581579
----------
582-
583580
groupby : str [default: type]
584581
if 'type':
585582
Group outputs by type (show all stdout, then all stderr, etc.):

ipyparallel/client/client.py

Lines changed: 37 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,10 +1185,9 @@ def activate(self, targets='all', suffix=''):
11851185
11861186
Parameters
11871187
----------
1188-
1189-
targets: int, list of ints, or 'all'
1188+
targets : int, list of ints, or 'all'
11901189
The engines on which the view's magics will run
1191-
suffix: str [default: '']
1190+
suffix : str [default: '']
11921191
The suffix, if any, for the magics. This allows you to have
11931192
multiple views associated with parallel magics at the same time.
11941193
@@ -1270,18 +1269,16 @@ def wait(self, jobs=None, timeout=-1):
12701269
12711270
Parameters
12721271
----------
1273-
12741272
jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects
1275-
ints are indices to self.history
1276-
strs are msg_ids
1277-
default: wait on all outstanding messages
1273+
ints are indices to self.history
1274+
strs are msg_ids
1275+
default: wait on all outstanding messages
12781276
timeout : float
1279-
a time in seconds, after which to give up.
1280-
default is -1, which means no timeout
1277+
a time in seconds, after which to give up.
1278+
default is -1, which means no timeout
12811279
12821280
Returns
12831281
-------
1284-
12851282
True : when all msg_ids are done
12861283
False : timeout reached, some msg_ids still outstanding
12871284
"""
@@ -1356,7 +1353,6 @@ def abort(self, jobs=None, targets=None, block=None):
13561353
13571354
Parameters
13581355
----------
1359-
13601356
jobs : msg_id, list of msg_ids, or AsyncResult
13611357
The jobs to be aborted
13621358
@@ -1405,14 +1401,13 @@ def shutdown(self, targets='all', restart=False, hub=False, block=None):
14051401
14061402
Parameters
14071403
----------
1408-
1409-
targets: list of ints or 'all' [default: all]
1404+
targets : list of ints or 'all' [default: all]
14101405
Which engines to shutdown.
1411-
hub: bool [default: False]
1406+
hub : bool [default: False]
14121407
Whether to include the Hub. hub=True implies targets='all'.
1413-
block: bool [default: self.block]
1408+
block : bool [default: self.block]
14141409
Whether to wait for clean shutdown replies or not.
1415-
restart: bool [default: False]
1410+
restart : bool [default: False]
14161411
NOT IMPLEMENTED
14171412
whether to restart engines after shutting them down.
14181413
"""
@@ -1466,22 +1461,20 @@ def become_dask(
14661461
14671462
Parameters
14681463
----------
1469-
1470-
targets: target spec (default: all)
1464+
targets : target spec (default: all)
14711465
Which engines to turn into dask workers.
1472-
port: int (default: random)
1466+
port : int (default: random)
14731467
Which port
1474-
nanny: bool (default: False)
1468+
nanny : bool (default: False)
14751469
Whether to start workers as subprocesses instead of in the engine process.
14761470
Using a nanny allows restarting the worker processes via ``executor.restart``.
1477-
scheduler_args: dict
1471+
scheduler_args : dict
14781472
Keyword arguments (e.g. ip) to pass to the distributed.Scheduler constructor.
1479-
**worker_args:
1473+
**worker_args
14801474
Any additional keyword arguments (e.g. ncores) are passed to the distributed.Worker constructor.
14811475
14821476
Returns
14831477
-------
1484-
14851478
client = distributed.Client
14861479
A dask.distributed.Client connected to the dask cluster.
14871480
"""
@@ -1527,8 +1520,7 @@ def stop_dask(self, targets='all'):
15271520
15281521
Parameters
15291522
----------
1530-
1531-
targets: target spec (default: all)
1523+
targets : target spec (default: all)
15321524
Which engines to stop dask workers on.
15331525
"""
15341526
dview = self.direct_view(targets)
@@ -1665,10 +1657,9 @@ def load_balanced_view(self, targets=None, **kwargs):
16651657
16661658
Parameters
16671659
----------
1668-
1669-
targets: list,slice,int,etc. [default: use all engines]
1660+
targets : list,slice,int,etc. [default: use all engines]
16701661
The subset of engines across which to load-balance execution
1671-
kwargs: passed to LoadBalancedView
1662+
**kwargs : passed to LoadBalancedView
16721663
"""
16731664
if targets == 'all':
16741665
targets = None
@@ -1683,13 +1674,11 @@ def executor(self, targets=None):
16831674
16841675
Parameters
16851676
----------
1686-
1687-
targets: list,slice,int,etc. [default: use all engines]
1677+
targets : list,slice,int,etc. [default: use all engines]
16881678
The subset of engines across which to load-balance execution
16891679
16901680
Returns
16911681
-------
1692-
16931682
executor: Executor
16941683
The Executor object
16951684
"""
@@ -1709,10 +1698,9 @@ def direct_view(self, targets='all', **kwargs):
17091698
17101699
Parameters
17111700
----------
1712-
1713-
targets: list,slice,int,etc. [default: use all engines]
1701+
targets : list,slice,int,etc. [default: use all engines]
17141702
The engines to use for the View
1715-
kwargs: passed to DirectView
1703+
**kwargs : passed to DirectView
17161704
"""
17171705
single = isinstance(targets, int)
17181706
# allow 'all' to be lazily evaluated at each execution
@@ -1731,11 +1719,10 @@ def broadcast_view(self, targets='all', is_coalescing=False, **kwargs):
17311719
17321720
Parameters
17331721
----------
1734-
1735-
targets: list,slice,int,etc. [default: use all engines]
1722+
targets : list,slice,int,etc. [default: use all engines]
17361723
The subset of engines across which to load-balance execution
1737-
is_coalescing: scheduler collects all messages from engines and returns them as one
1738-
kwargs: passed to BroadCastView
1724+
is_coalescing : scheduler collects all messages from engines and returns them as one
1725+
**kwargs : passed to BroadCastView
17391726
"""
17401727
targets = self._build_targets(targets)[1]
17411728

@@ -1771,11 +1758,9 @@ def get_result(self, indices_or_msg_ids=None, block=None, owner=True):
17711758
17721759
Parameters
17731760
----------
1774-
17751761
indices_or_msg_ids : integer history index, str msg_id, AsyncResult,
17761762
or a list of same.
17771763
The indices or msg_ids of indices to be retrieved
1778-
17791764
block : bool
17801765
Whether to wait for the result to be done
17811766
owner : bool [default: True]
@@ -1786,10 +1771,8 @@ def get_result(self, indices_or_msg_ids=None, block=None, owner=True):
17861771
17871772
Returns
17881773
-------
1789-
17901774
AsyncResult
17911775
A single AsyncResult object will always be returned.
1792-
17931776
AsyncHubResult
17941777
A subclass of AsyncResult that retrieves results from the Hub
17951778
@@ -1812,16 +1795,13 @@ def resubmit(self, indices_or_msg_ids=None, metadata=None, block=None):
18121795
18131796
Parameters
18141797
----------
1815-
18161798
indices_or_msg_ids : integer history index, str msg_id, or list of either
18171799
The indices or msg_ids of indices to be retrieved
1818-
18191800
block : bool
18201801
Whether to wait for the result to be done
18211802
18221803
Returns
18231804
-------
1824-
18251805
AsyncHubResult
18261806
A subclass of AsyncResult that retrieves results from the Hub
18271807
@@ -1855,7 +1835,6 @@ def result_status(self, msg_ids, status_only=True):
18551835
18561836
Parameters
18571837
----------
1858-
18591838
msg_ids : list of msg_ids
18601839
if int:
18611840
Passed as index to self.history for convenience.
@@ -1865,7 +1844,6 @@ def result_status(self, msg_ids, status_only=True):
18651844
18661845
Returns
18671846
-------
1868-
18691847
results : dict
18701848
There will always be the keys 'pending' and 'completed', which will
18711849
be lists of msg_ids that are incomplete or complete. If `status_only`
@@ -1952,12 +1930,11 @@ def queue_status(self, targets='all', verbose=False):
19521930
19531931
Parameters
19541932
----------
1955-
19561933
targets : int/str/list of ints/strs
1957-
the engines whose states are to be queried.
1958-
default : all
1934+
the engines whose states are to be queried.
1935+
default : all
19591936
verbose : bool
1960-
Whether to return lengths only, or lists of ids for each element
1937+
Whether to return lengths only, or lists of ids for each element
19611938
"""
19621939
if targets == 'all':
19631940
# allow 'all' to be evaluated on the engine
@@ -2068,15 +2045,13 @@ def purge_local_results(self, jobs=[], targets=[]):
20682045
20692046
Parameters
20702047
----------
2071-
20722048
jobs : str or list of str or AsyncResult objects
2073-
the msg_ids whose results should be purged.
2049+
the msg_ids whose results should be purged.
20742050
targets : int/list of ints
2075-
The engines, by integer ID, whose entire result histories are to be purged.
2051+
The engines, by integer ID, whose entire result histories are to be purged.
20762052
20772053
Raises
20782054
------
2079-
20802055
RuntimeError : if any of the tasks to be purged are still outstanding.
20812056
20822057
"""
@@ -2117,13 +2092,12 @@ def purge_hub_results(self, jobs=[], targets=[]):
21172092
21182093
Parameters
21192094
----------
2120-
21212095
jobs : str or list of str or AsyncResult objects
2122-
the msg_ids whose results should be forgotten.
2096+
the msg_ids whose results should be forgotten.
21232097
targets : int/str/list of ints/strs
2124-
The targets, by int_id, whose entire history is to be purged.
2098+
The targets, by int_id, whose entire history is to be purged.
21252099
2126-
default : None
2100+
default : None
21272101
"""
21282102
if not targets and not jobs:
21292103
raise ValueError("Must specify at least one of `targets` and `jobs`")
@@ -2156,13 +2130,12 @@ def purge_results(self, jobs=[], targets=[]):
21562130
21572131
Parameters
21582132
----------
2159-
21602133
jobs : str or list of str or AsyncResult objects
2161-
the msg_ids whose results should be forgotten.
2134+
the msg_ids whose results should be forgotten.
21622135
targets : int/str/list of ints/strs
2163-
The targets, by int_id, whose entire history is to be purged.
2136+
The targets, by int_id, whose entire history is to be purged.
21642137
2165-
default : None
2138+
default : None
21662139
"""
21672140
self.purge_local_results(jobs=jobs, targets=targets)
21682141
self.purge_hub_results(jobs=jobs, targets=targets)
@@ -2188,9 +2161,8 @@ def hub_history(self):
21882161
21892162
Returns
21902163
-------
2191-
21922164
msg_ids : list of strs
2193-
list of all msg_ids, ordered by task submission time.
2165+
list of all msg_ids, ordered by task submission time.
21942166
"""
21952167

21962168
reply = self._send_recv(self._query_stream, "history_request", content={})
@@ -2207,7 +2179,6 @@ def db_query(self, query, keys=None):
22072179
22082180
Parameters
22092181
----------
2210-
22112182
query : mongodb query dict
22122183
The search dict. See mongodb query docs for details.
22132184
keys : list of strs [optional]

ipyparallel/client/magics.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ def autopx(self, line=''):
378378
used, the ``targets`` attribute of the view before
379379
entering ``%autopx`` mode.
380380
381-
382381
Then you can do the following::
383382
384383
In [25]: %autopx
@@ -393,7 +392,6 @@ def autopx(self, line=''):
393392
[stdout:2] 10
394393
[stdout:3] 10
395394
396-
397395
In [27]: %autopx
398396
%autopx disabled
399397
"""

0 commit comments

Comments
 (0)