Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NumPy style docstrings. #392

Merged
merged 34 commits into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
85f8e68
Use napoleon to render numpydoc style.
bdice Dec 7, 2020
93fbae5
NumPy-doc-ify aggregates.
bdice Dec 7, 2020
6f4883d
Fix name of aggregator class.
bdice Dec 8, 2020
852c1a8
Revisions to environment docstrings.
bdice Dec 8, 2020
331c267
Revisions to aggregate docstrings.
bdice Dec 8, 2020
e023704
NumPy-doc-ify INCITE environments.
bdice Dec 8, 2020
efcd9ee
NumPy-doc-ify remaining environments.
bdice Dec 8, 2020
422abec
NumPy-doc-ify render_status.
bdice Dec 8, 2020
ae16bfc
NumPy-doc-ify scheduler base classes.
bdice Dec 8, 2020
c0a9f64
NumPy-doc-ify LSF scheduler.
bdice Dec 8, 2020
d7ed093
NumPy-doc-ify simple scheduler.
bdice Dec 8, 2020
20bcbe0
NumPy-doc-ify SLURM scheduler.
bdice Dec 8, 2020
1478e0b
NumPy-doc-ify Torque scheduler.
bdice Dec 8, 2020
bce58b3
NumPy-doc-ify template.
bdice Dec 8, 2020
e7607a7
NumPy-doc-ify testing.
bdice Dec 8, 2020
4a74d17
NumPy-doc-ify util.
bdice Dec 8, 2020
e6d3b0f
NumPy-doc-ify project.
bdice Dec 9, 2020
0701888
Fix remaining sphinx-style docstrings.
bdice Dec 9, 2020
9a19fac
Updated docstrings with velin (https://github.com/Carreau/velin).
bdice Dec 9, 2020
1b783ab
Adopt numpy convention for pydocstyle.
bdice Dec 9, 2020
88d64a0
Remove methods that are implemented identically in the parent class.
bdice Dec 9, 2020
398770a
Add call operators to docs.
bdice Dec 9, 2020
e4a76db
Fix FlowGroup reference.
bdice Dec 9, 2020
24cdf75
Reformat examples.
bdice Dec 10, 2020
09160d8
Remove trailing colons where no type is specified.
bdice Dec 10, 2020
4b7f721
Fix class reference.
bdice Dec 10, 2020
8d8646e
Fix (deprecated) JobOperation references.
bdice Dec 10, 2020
9009988
Use preconditions/postconditions.
bdice Dec 10, 2020
c2f9195
Add changelog line.
bdice Dec 10, 2020
3737c69
Apply suggestions from code review
bdice Dec 11, 2020
5c506ce
Move env argument.
bdice Dec 11, 2020
21a8933
Fix typo.
bdice Dec 11, 2020
9abf5cd
Apply suggested changes.
bdice Dec 11, 2020
a371289
Add docs to simple-scheduler, don't git ignore the bin directory cont…
bdice Dec 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dist
build
eggs
parts
bin
var
sdist
develop-eggs
Expand Down
23 changes: 23 additions & 0 deletions bin/simple-scheduler
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/usr/bin/env python
# Copyright (c) 2020 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"""A simple scheduler implementation that works with signac-flow.

The package signac-flow includes the ``simple-scheduler`` script as a simple
model of a cluster job scheduler. The ``simple-scheduler`` script is designed
primarily for testing and demonstration.
"""
import argparse
import json
import logging
Expand Down Expand Up @@ -41,6 +50,11 @@ def _get_args(script):


def main_submit(args):
"""Submit jobs.

Jobs are accepted from a provided filename and copied to a unique name in
the scheduler's inbox.
"""
# Try to parse args, should raise error if anything is wrong or missing
with open(args.filename) as script:
_get_submit_parser().parse_args(list(_get_args(script)))
Expand Down Expand Up @@ -152,6 +166,11 @@ def _process_queue(args, db):


def main_run(args):
"""Run the scheduler.

The scheduler runs multiple threads. A separate thread moves jobs from the
inbox to a queue. The main thread processes jobs in the queue.
"""
print("Start scheduler...")
os.makedirs(args.inbox, exist_ok=True)
os.makedirs(args.queue, exist_ok=True)
Expand All @@ -175,6 +194,10 @@ def main_run(args):


def main_status(args):
"""Get job status.

This returns the status of all jobs from the scheduler's database.
"""
with Collection.open(args.db, mode="r") as db:
if args.json:
print(json.dumps({doc["_id"]: doc for doc in db}, indent=4))
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Changed
+++++++
- Command line interface always uses ``--job-id`` instead of ``--jobid`` (#363, #386).
- ``CPUEnvironment`` and ``GPUEnvironment`` classes are deprecated (#381).
- Docstrings are now written in `numpydoc style <https://numpydoc.readthedocs.io/en/latest/format.html>`__ (#392).

Version 0.11
============
Expand Down
23 changes: 23 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,33 @@ Operations and Status
.. autoclass:: flow.project.FlowOperation
:show-inheritance:
:members:
:special-members: __call__

.. autoclass:: flow.project.FlowCmdOperation
:show-inheritance:
:members:
:special-members: __call__

.. autoclass:: flow.project.JobOperation
:members:

.. autoclass:: flow.render_status.Renderer
:members: generate_terminal_output, generate_html_output, render

Labels
------

.. autoclass:: flow.label
:members:
:special-members: __call__

.. autoclass:: flow.staticlabel
:members:
:special-members: __call__

.. autoclass:: flow.classlabel
:members:
:special-members: __call__

@flow.cmd
---------
Expand All @@ -135,6 +151,8 @@ Operations and Status
----------------

.. autoclass:: directives
:members:
:special-members: __call__

flow.run()
----------
Expand All @@ -157,13 +175,18 @@ The FlowGroup
.. autoclass:: flow.project.FlowGroup
:members:

.. autoclass:: flow.project.FlowGroupEntry
:members:
:special-members: __call__

Aggregation
-----------

.. automodule:: flow.aggregates

.. autoclass:: flow.aggregates.aggregator
:members:
:special-members: __call__

.. autofunction:: flow.aggregates.get_aggregate_id

Expand Down
2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Mock(MagicMock):

@classmethod
def __getattr__(cls, name):
"""Get mocked attribute."""
if name == "_mock_methods":
return []
return Mock()
Expand All @@ -45,6 +46,7 @@ def __getattr__(cls, name):
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]

Expand Down
Loading