celery-slack icon indicating copy to clipboard operation
celery-slack copied to clipboard

Allow change username & ignore certain exceptions

Open palvarezcordoba opened this issue 5 years ago • 3 comments

  • You can add show_custom_username=True when instantiating Slackify to send messages with a custom username. By default uses hostname@task_name. It can be overrided passing a username kwarg to Slackify. In the context of startup/shutdown messages there is not any task name so we will use celery by default, it can be overriden passing service_name kwarg to Slackify.
  • Now you can silent certain exceptions using the ignore decorator like this:
from . import app
from slackify import ignore
from blah.exceptions import Timeout
from abc.exceptions import AwesomeException

@app.task(name="some_task")
@ignore(Timeout, AwesomeException)
def some_task(): pass

closes #8 closes #10

palvarezcordoba avatar Sep 26 '19 11:09 palvarezcordoba

Hey @palvarezcordoba sorry for letting this fall through the cracks. I should have some time this weekend to go over this. Should I close the previous PR and consider this one instead?

crflynn avatar Sep 27 '19 00:09 crflynn

@crflynn I've closed it. This is the good PR. Here I don't use tricks involving inspect.trace. I haven't written the tests yet.

palvarezcordoba avatar Sep 27 '19 10:09 palvarezcordoba

Hey I think these are good features to include. I could help write the tests out if you'd like to collaborate on this.

crflynn avatar Oct 13 '19 15:10 crflynn