Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Multiprocessing problems #90

Open
kjetilmjos opened this issue Sep 19, 2017 · 12 comments
Open

Multiprocessing problems #90

kjetilmjos opened this issue Sep 19, 2017 · 12 comments

Comments

@kjetilmjos
Copy link

Hi I'm experiencing problems with the .apply_asynch method in the helper.py line 20.
If I leave the .apply_asynch on no notifications are sent. Have tried to remove asynch by replacing the line:
send_notifications.apply_async((notification.id,) ,eta=notification.send_at)
with
send_notifications(notification.id)
This works and I'm then able to send notifications.

Problem is then off-course that only the first configured notification is sent due to the code being synchronous. Has anybody encountered the same issues?

Really like the functionality of Openduty and to have a open source and free alternative to the expensive pagerduty etc. Would be really nice if we could get a more active community up and running around the repo and maybe port the code to python 3?

This was referenced Sep 19, 2017
@hanynowsky
Copy link

The Twilio Notification works fine for me. I receive SMS. Well at least the first time.
The email notification has an issue. It does not work. The task is executed but after 254 seconds, reports an error. I am going to check shortly again what error it reports.

@hanynowsky
Copy link

hanynowsky commented Sep 21, 2017

Well. Sounds there is a strange problem.
`[2017-09-21 09:41:59,617: INFO/MainProcess] Received task: notification.tasks.send_notifications[d7e0b16d-f6f7-4ab1-9849-651249ea7463] eta:[2017-09-21 09:41:55.707664+00:00]
[2017-09-21 09:41:59,630: INFO/MainProcess] Received task: notification.tasks.send_notifications[767dd7cc-6da7-415f-b1a4-75f904772ae4] eta:[2017-09-21 09:42:55.707664+00:00]
[2017-09-21 09:41:59,646: INFO/MainProcess] Received task: notification.tasks.send_notifications[82f101d7-614b-4091-a0cc-30686ce50871] eta:[2017-09-21 09:43:55.707664+00:00]

[2017-09-21 09:42:55,736: WARNING/ForkPoolWorker-6] Failed to send Rocket message:Invalid URL u'': No schema supplied. Perhaps you meant http://?
[2017-09-21 09:42:55,748: ERROR/MainProcess] Task notification.tasks.send_notifications[767dd7cc-6da7-415f-b1a4-75f904772ae4] raised unexpected: MissingSchema("Invalid URL u'': No schema supplied. Perhaps you meant http://?",)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 438, in protected_call
return self.run(*args, **kwargs)
File "/opt/openduty/notification/tasks.py", line 39, in send_notifications
notifier.notify(notification)
File "/opt/openduty/notification/notifier/rocket.py", line 11, in notify
response = requests.post(notification.user_to_notify.profile.rocket_webhook_url, payload)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 94, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 49, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 443, in request
prep = self.prepare_request(req)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 374, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 304, in prepare
self.prepare_url(url, params)
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 358, in prepare_url
"Perhaps you meant http://{0}?".format(url))
MissingSchema: Invalid URL u'': No schema supplied. Perhaps you meant http://?

[2017-09-21 09:43:56,740: INFO/MainProcess] Task notification.tasks.send_notifications[82f101d7-614b-4091-a0cc-30686ce50871] succeeded in 1.02826371184s: None
[2017-09-21 09:45:34,150: INFO/MainProcess] Task notification.tasks.send_notifications[df846dc0-849a-4a96-8242-a8cf5dcdd7fb] succeeded in 254.66852079s: None
[2017-09-21 09:45:34,164: INFO/MainProcess] Task notification.tasks.send_notifications[6ecd0750-0d07-4306-be5c-cdccd211149d] succeeded in 254.678968812s: None
`

@hanynowsky
Copy link

Well notifications seem not working for me when an incident is triggered. They only work when I click on the TEST NOTIFICATIONS in the user page. :(
The error I have now is related to ROCKET config. I don't know how it should be, since there is no doc for it.
Well for now I did not modify any code yet!

@hanynowsky
Copy link

hanynowsky commented Sep 21, 2017

Ok. I confirm that notifications for Twilio SMS are working when an event is triggered.
[2017-09-21 10:01:05,581: INFO/MainProcess] Task notification.tasks.send_notifications[64576a82-1608-400b-a985-dd254449c99a] succeeded in 0.981761767995s: None

I receive Twilio SMS on my phone.

@hanynowsky
Copy link

I am running on a Debian 8

@hanynowsky
Copy link

hanynowsky commented Sep 21, 2017

Fixed for ROCKET first error. Rocket Webhook URl must be set in USer's profile not in settings.py
and modified the rocket notifier to set SSL verification to False, otherwise it throws and SSL handshake error.

@kjetilmjos
Copy link
Author

Found the "Solution" pretty embarrassing... Turns out celery has to be started seperately. Probably therefore 'celery -A openduty worker -l info' is listed in the Readme file...

@hanynowsky
Copy link

@kjetilmjos co gratulations.
I thought that was obvious to you. The readme file must be rewritten.

Anyway, have you succeeded in running celery using supervisord as a daemonizer?
I am running openduty django app using supervisor and it s fine, but no way with celery.
FYI, i am not using virtualenv, since debian jessie comes with python 2.7 natively.

@kjetilmjos
Copy link
Author

Is that the same as running it in daemon mode using systemd? I found a fork from Oxalide, they have made the pull request here with a range of improvements posted by @sofixa. In their repo there is also a folder showing how the project can be runned as deamon using systemd. Check out the systemd folder at: https://github.com/Oxalide/openduty

@hanynowsky
Copy link

Perfect. That is better. Thanks a lot.
For the email, i guess there is another way to use yours by adding a custom notifier.
The default one if for gmail.

@kjetilmjos
Copy link
Author

The one I use works with the oxalide fork. They have written a more general email notifier than the original email based one.

@hanynowsky
Copy link

hanynowsky commented Sep 22, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants