Example how to set up a custom event handler?

General discussions and questions.
Post Reply
gmaxera
Posts: 10
Joined: Thu Feb 09, 2017 3:59 pm

Example how to set up a custom event handler?

Post 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.
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post 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
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
gmaxera
Posts: 10
Joined: Thu Feb 09, 2017 3:59 pm

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

Post 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.
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post by timurhai »

:)
I should write it in docs in server events section.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post by timurhai »

And i did it.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
Post Reply