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

only subscribe if actions are available #403

Open
wants to merge 3 commits into
base: v1.x.y
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"

Expand All @@ -43,7 +43,7 @@ jobs:
echo TARGZ=$(echo dist/*.tar.gz) >> $GITHUB_OUTPUT

- name: Archive package
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: distributions
path: dist
Expand All @@ -62,15 +62,15 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: distributions
path: dist
Expand Down Expand Up @@ -99,15 +99,15 @@ jobs:
--log-file pytest_${{ matrix.os }}_py${{ matrix.python-version }}_${{ env.SUFFIX }}.log

- name: Archive test result
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: success() || failure() # upload artifacts also if test stage failed
with:
name: unittest_reports
path: pytest_reports/unittest_report_${{ matrix.os }}_py${{ matrix.python-version }}_${{ env.SUFFIX }}.html
retention-days: 5

- name: Archive test log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: success() || failure() # upload artifacts also if test stage failed
with:
name: pytest_logs
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: distributions
path: dist/
Expand All @@ -46,16 +46,16 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download Build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: distributions
path: dist

- name: Download Unittest report
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: unittest_reports
path: pytest_reports/
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- accessing a multikey may lead to IndexError [#359](https://github.com/Draegerwerk/sdc11073/issues/359)
- fixed a bug where `log_prefix` can only be a string [#393](https://github.com/Draegerwerk/sdc11073/issues/393)
- only send subscribe request if there are actions to subscribe to [#402](https://github.com/Draegerwerk/sdc11073/issues/402)

## [1.3.2] - 2024-03-18

Expand Down
15 changes: 8 additions & 7 deletions src/sdc11073/sdcclient/sdcclientimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,14 @@ def startAll(self, notSubscribedActions=None, subscriptionsCheckInterval=None, a
subscribe_actions = set(available_actions) - notSubscribedActionsSet
if not subscribe_periodic_reports:
subscribe_actions -= set(periodic_actions)
try:
self._subscribe(dpwsHosted, subscribe_actions,
self._onAnyStateEventReport)
except Exception as ex:
self.all_subscribed = False # => do not log errors when mdib versions are missing in notifications
self._logger.error('startAll: could not subscribe: error = {}, actions= {}',
traceback.format_exc(), subscribe_actions)
if subscribe_actions:
try:
self._subscribe(dpwsHosted, subscribe_actions,
self._onAnyStateEventReport)
except Exception as ex:
self.all_subscribed = False # => do not log errors when mdib versions are missing in notifications
self._logger.error('startAll: could not subscribe: error = {}, actions= {}',
traceback.format_exc(), subscribe_actions)

# connect self.isConnected observable to allSubscriptionsOkay observable in subscriptionsmanager
def setIsConnected(isOk):
Expand Down
Loading