Skip to content

Commit c52266a

Browse files
committed
improving documentation
1 parent 67a5ce5 commit c52266a

File tree

9 files changed

+55
-13
lines changed

9 files changed

+55
-13
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ clean:
4545
docs:
4646
make -C docs html
4747
@echo "open file://`pwd`/docs/_build/html/index.html"
48+
49+
.PHONY: deploy-docs
50+
deploy-docs: docs
51+
ghp-import -m "update docs" -p docs/_build/html/

arq/jobs.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
:mod:`jobs`
33
===========
4+
5+
Defines the ``Job`` class and decedents which deal with encoding and decoding job data.
46
"""
57
from datetime import datetime
68

@@ -85,9 +87,10 @@ def __repr__(self):
8587

8688
class DatetimeJob(Job):
8789
"""
88-
Alternative Job which
90+
Alternative Job which copes with datetimes. None timezone naïve dates are supported but
91+
the returned datetimes will use python datetime's ``timezone`` class to define the timezone
92+
regardless of the timezone class originally used on the datetime object.
8993
"""
90-
9194
@staticmethod
9295
def msgpack_encoder(obj):
9396
if isinstance(obj, datetime):

arq/main.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
:mod:`main`
33
===========
4+
5+
Defines the main ``Actor`` class and ``concurrent`` decorator for using arq from within your code.
46
"""
57
import inspect
68
import logging

arq/testing.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
"""
22
:mod:`testing`
33
==============
4+
5+
pytest plugin and other utilities useful when writing tests for code using arq.
6+
7+
include the plugin in your tests's `conftest.py` file with::
8+
9+
pytest_plugins = 'arq.testing'
10+
11+
See arq's own tests for examples of usage.
412
"""
513
import asyncio
614
import contextlib

arq/utils.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
2-
:mod:`utilities`
3-
================
2+
:mod:`utils`
3+
============
4+
5+
Utilises for running arq used by modules.
46
"""
57
import asyncio
68
import base64

arq/worker.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
:mod:`worker`
33
=============
4+
5+
Responsible for executing jobs in the worker processes.
46
"""
57
import asyncio
68
import logging
@@ -310,7 +312,15 @@ def import_string(file_path, attr_name):
310312
return attr
311313

312314

313-
def start_worker(worker_path, worker_class, burst, loop=None):
315+
def start_worker(worker_path: str, worker_class: str, burst: bool, loop: asyncio.AbstractEventLoop=None):
316+
"""
317+
Run from within the subprocess to load the worker class and execute jobs.
318+
319+
:param worker_path: full path to the python file containing the worker definition
320+
:param worker_class: name of the worker class to be loaded and used
321+
:param burst: whether or not to run in burst mode
322+
:param loop: asyncio loop use to or None
323+
"""
314324
worker_cls = import_string(worker_path, worker_class)
315325
worker = worker_cls(burst=burst, loop=loop)
316326
work_logger.info('Starting %s on worker process pid=%d', worker_cls.__name__, os.getpid())
@@ -327,6 +337,9 @@ def start_worker(worker_path, worker_class, burst, loop=None):
327337

328338

329339
class RunWorkerProcess:
340+
"""
341+
Responsible for starting a process to run the worker, monitoring it and possibly killing it.
342+
"""
330343
def __init__(self, worker_path, worker_class, burst=False):
331344
signal.signal(signal.SIGINT, self.handle_sig)
332345
signal.signal(signal.SIGTERM, self.handle_sig)

docs/conf.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,16 @@
134134
# further. For a list of options available for each theme, see the
135135
# documentation.
136136
#
137-
# html_theme_options = {}
137+
html_theme_options = {
138+
'github_user': 'samuelcolvin',
139+
'github_repo': 'arq',
140+
'travis_button': True,
141+
'codecov_button': True,
142+
'page_width': '1200px',
143+
'github_banner': True,
144+
145+
'github_type': 'star',
146+
}
138147

139148
# Add any paths that contain custom themes here, relative to this directory.
140149
# html_theme_path = []
@@ -184,7 +193,11 @@
184193
# Custom sidebar templates, maps document names to template names.
185194
#
186195
html_sidebars = {
187-
'**': ['localtoc.html', 'searchbox.html'],
196+
'**': [
197+
'about.html',
198+
'localtoc.html',
199+
'searchbox.html',
200+
]
188201
}
189202

190203
# Additional templates that should be rendered to pages, maps page names to

docs/index.rst

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ arq
44
.. toctree::
55
:maxdepth: 2
66

7-
|Build Status| |Coverage| |pypi| |license|
7+
|pypi| |license|
88

99

1010
Job queues in python with asyncio, redis and msgpack.
@@ -61,7 +61,7 @@ API Reference
6161
:members:
6262

6363
.. automodule:: arq.jobs
64-
:members:
64+
:members: Job, DatetimeJob
6565

6666
.. automodule:: arq.logs
6767
:members:
@@ -79,10 +79,6 @@ Indices and tables
7979
* :ref:`modindex`
8080
* :ref:`search`
8181

82-
.. |Build Status| image:: https://travis-ci.org/samuelcolvin/arq.svg?branch=master
83-
:target: https://travis-ci.org/samuelcolvin/arq
84-
.. |Coverage| image:: https://codecov.io/gh/samuelcolvin/arq/branch/master/graph/badge.svg
85-
:target: https://codecov.io/gh/samuelcolvin/arq
8682
.. |pypi| image:: https://img.shields.io/pypi/v/arq.svg
8783
:target: https://pypi.python.org/pypi/arq
8884
.. |license| image:: https://img.shields.io/pypi/l/arq.svg

tests/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ coverage
33
docutils
44
flake8
55
isort
6+
ghp-import
67
pep8
78
pytest
89
pytest-cov

0 commit comments

Comments
 (0)