Page 1 of 1

Example how to set up a custom event handler?

Posted: Thu Feb 23, 2017 9:54 am
by gmaxera
hello,
I read in the documentation about the possibility to attach event handler:
http://cgru.info/afanasy/server#events

But it's not clear to me what are the steps involved to:
- create a custom event handler
- set up the server to fire my event handler on JOB_DONE

Is there an example ?

Thanks,
Gianluca.

Re: Example how to set up a custom event handler?

Posted: Thu Feb 23, 2017 11:08 am
by timurhai
Hi.
Your link contains an example how invoke email notifications (that was written for example too).
If user will have such custom data, done and error jobs will be emailed.
This events.py Python service code will be executed :
https://github.com/CGRU/cgru/blob/maste ... ts.py#L111
You can write own "events_my.py" and specify your custom class here:
https://github.com/CGRU/cgru/blob/maste ... .json#L197

Re: Example how to set up a custom event handler?

Posted: Thu Feb 23, 2017 11:10 am
by gmaxera
Thank you !

I was looking for 1 hour to config.json for a line such

"af_sysjob_events_service":"events"

without finding it :-D

It was there under my eyes all the time :-D

Thanks,
Gianluca.

Re: Example how to set up a custom event handler?

Posted: Thu Feb 23, 2017 11:43 am
by timurhai
:)
I should write it in docs in server events section.

Re: Example how to set up a custom event handler?

Posted: Thu Feb 23, 2017 3:34 pm
by timurhai
And i did it.