Skip to content

Commit

Permalink
Provide better guidance on what to override
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Sep 8, 2023
1 parent c014ae1 commit 0ab66ae
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions doc/source/dev/build_a_job_runner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,27 @@ contains the base runner implementation. To create a new runner, the base
runner class (in most cases, ``AsynchronousJobRunner``) must be inherited and only certain methods need to be
overridden with your logic.

These are the methods that need to be implemented, with custom logic added as needed:
These are the methods that need to be implemented:

1. ``__init__(app, nworkers, **kwargs)``
1. ``queue_job(job_wrapper)``

2. ``queue_job(job_wrapper)``
2. ``check_watched_item(job_state)``

3. ``check_watched_item(job_state)``
3. ``stop_job(job)``

4. ``stop_job(job)``
4. ``recover(job, job_wrapper)``

5. ``recover(job, job_wrapper)``
In addition, you will almost certainly override the ``__init__(app, nworkers, **kwargs)``
method in order to add custom logic to initialize your runner. In
doing so, make sure to call the parent class constructor:

.. code-block:: python
super().__init__(app, nworkers, **kwargs)
Keep in mind that when you override a method, you should not reimplement any of
the logic that is present in the base class: the above call to ``super()``
ensures that all that such logic is handled automatically.

The big picture
---------------
Expand Down

0 comments on commit 0ab66ae

Please sign in to comment.