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

silence pylint warning about pika dep in tool #5380

Merged
merged 2 commits into from
Oct 6, 2021

Conversation

cognifloyd
Copy link
Member

Every now and then, pylint gets upset about a pika import in tools/direct_queue_publisher.py. Here's a snippet from a GHA run in #5096 (NB: that PR does not touch any of these files, so fixing this in that PR doesn't make sense):

. virtualenv/bin/activate; pylint -j 4 -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models tools/*.py || exit 1;
************* Module tools.direct_queue_publisher
tools/direct_queue_publisher.py:21:0: E0401: Unable to import 'pika' (import-error)
make: *** [Makefile:351: .pylint] Error 1

https://github.com/StackStorm/st2/pull/5096/checks?check_run_id=3808812826#step:11:467

I think it's weird that we're not consistently getting this error because pylint should be running on all the tools files:

st2/Makefile

Line 361 in f65f62f

. $(VIRTUALENV_DIR)/bin/activate; pylint -j $(PYLINT_CONCURRENCY) -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models tools/*.py || exit 1;

This tool dates back to April 2016 (f6897d2) with this in the commit message:

  • Exisiting tool queue_producer published to an exchange. This is for direct publishing to a queue.
  • Written on top of pika instead of kombu as this was simpler to write given code samples on rabbitmq tutorial site

Plus, from what I can tell, kombu doesn't offer a way to publish directly to a queue; it requires an exchange. So this tool has to use something other than kombu.

So, we can either delete this script or leave it around for possible future debugging. To leave it around, we should protect it such that pylint doesn't complain and anyone who tries to use it gets a helpful message about why it doesn't work. That's what I did in this PR.

@pull-request-size pull-request-size bot added the size/XS PR that changes 0-9 lines. Quick fix/merge. label Oct 6, 2021
Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but could you also add a changelog entry,

@pull-request-size pull-request-size bot added size/S PR that changes 10-29 lines. Very easy to review. and removed size/XS PR that changes 0-9 lines. Quick fix/merge. labels Oct 6, 2021
@cognifloyd cognifloyd merged commit 245ef63 into StackStorm:master Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance pantsbuild size/S PR that changes 10-29 lines. Very easy to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants