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
Slack #170
Slack #170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost missed it: can you fix the three code smells? See
https://sonarcloud.io/project/issues?id=snakemake_snakemake&pullRequest=170&resolved=false&types=CODE_SMELL
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
### Description <!--Add a description of your PR here--> This updates the Slack ``--log-service`` feature added in #170. The ``Slacker`` package is no longer maintained, and legacy slack tokens are no longer generatable. I've replace it with the officially supported [Slack SDK](https://github.com/slackapi/python-slack-sdk) (see ``setup.cfg``), preserving the original functionality with minimal adjustments. This has been minimally tested for functionality. However, the original implementation has a couple issues (which this PR **does not** address) - 1. Lack of `docs/` on how to set up the ``--log-service slack`` feature via Slack 2. Logic is not robust - e.g. when `msg["done"] == msg["total"]`, this does not mean the workflow is complete (checkpoints) 3. The implementation of ``--log-service slack`` is synchronous, meaning that Snakemake workflows will wait for the implemented `log_handler` function to finish. For normal print statements, this isn't an issue, but repeated calls of Slack WebAPI's `postMessage` can significantly slow things down. Depending on the workflow (Snakefile), this can become noticeable. 4. The implementation does not comply with Slack WebAPI's rate limiting. The current implementation will look like this - messages on slack are sent by the user, using a user OAuth token. ![image](https://github.com/snakemake/snakemake/assets/43220811/69e3b335-13fc-4af1-8538-8d65920f9494) I've already addressed points 2, 3, and 4 in a private repository using ``--log-handler`` that should be integrable into this current implementation, but it has not been robustly tested (integration can happen at a later PR). ![image](https://github.com/snakemake/snakemake/assets/43220811/97576f52-1c46-4237-806a-e823bd76f9f7) Thanks! ### QC <!-- Make sure that you can tick the boxes below. --> * [ ] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [ ] The documentation (`docs/`) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake). --------- Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
This allows snakemake to use an exported slack legacy token to send the user a message on successfully executed and failed workflows. It is written in a way that additional messaging services can be added in near future.
The creators of slack recommend to not use legacy tokens anymore, but their newly provided slack app system. This provides indeed many additional features, but as far as I can see this would require the user to configure the channel for a snakemake communication. Since there would be no improvement in security and the task is to only send simple messages to the executing user, in my opinion the legacy tokens are sufficient.