Notification system design

by Lokesh Agrawal   Last Updated May 15, 2019 17:05 PM - source

Class Design for the Notification system from a system like Batch. I am building a workflow automation system in Python (Batch Job execution). It has features like sending notification on success/failure of batch command execution. Check examples below.

Static notification:

<job>
   name job1
   <notify>
      type mail
      failure [email protected]
   </notify>
   <command>
      echo hello loki
   </command>
</job>

Dynamic notification

def time_in_range(start, end, x):
   """Return true if x is in the range [start, end]"""
    if start <= end:
       return start <= x <= end
   else:
       return start <= x or x <= end  

<job> 
   name job2
   <notify>
      type mail
      <rule>
          condition time_in_range(datetime.time(13, 0, 0), datetime.time(1,0,0), datetime.currenttime())
          true [email protected]
          false [email protected] 
      </rule>
   </notify>
   <command>
      echo hello loki
   </command>
</job>

Can you suggest some designs for the same? How do classes look like in its design, what holds what?



Related Questions





Building entities first

Updated November 23, 2017 17:05 PM

How should I structure these Python classes?

Updated August 06, 2015 14:02 PM