Skip to content

#135 executor abstraction with two implementations: docs+examples #146

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

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Features
--------
* easily plug event handling scripts for all Orthanc's `change events`_ -
* chain functions into a pipeline (composition)
* run asyncio functions (coroutines) for concurrent processing of a change event
* run asyncio functions (coroutines) for concurrent processing of change events
* run (integration) tests for your Orthanc python scripts
* publish events to Kafka, RabbitMQ and NATS

Expand All @@ -54,7 +54,7 @@ Httpx was chosen as a base library to access the Orthanc API, rather than orthan
developer friendly, and external API access avoids deadlocks in the Python plugin (before this was solved in 3.1).


Running
Getting Started
-------

``entry_point.py`` provides the first boilerplate to get started. Run it by issuing
Expand Down
6 changes: 3 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ specified in orthanc.json or as an environment variable for the Osimis docker im
logging.warn(evt.resource_id)

event_dispatcher.register_event_handlers({orthanc.ChangeType.STABLE_STUDY: log_event}, orthanc_module=orthanc,
session=event_dispatcher.create_session(orthanc))
sync_client=event_dispatcher.create_session(orthanc))

To unit test the log_event handler with pytest, use::

Expand All @@ -26,7 +26,7 @@ To unit test the log_event handler with pytest, use::

assert 'resource-uuid' in caplog.text

One can use the excellent responses_ library to stub the API responses.
One can use the excellent respx_ library to stub the API responses.

To integration test a handler, use::

Expand All @@ -53,4 +53,4 @@ To integration test a handler, use::
The event_dispatcher will ensure that your API call will work the same when called from the Orthanc Python plugin.
For more examples, see the tests/ directory in the Git repository.

.. _responses: https://github.com/getsentry/responses
.. respx: https://lundberg.github.io/respx/
2 changes: 1 addition & 1 deletion tests/test_event_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from functools import partial

import httpx
import respx
import pytest
import respx

from orthanc_ext import event_dispatcher
from orthanc_ext.http_utilities import create_internal_client, ClientType
Expand Down
Loading