NotificationHandler

The Notification service provides a toolkit to contact people via email (eventually SMS etc.) to trigger some actions.

The original motivation for this is due to some sites restricting the sending of email but it is useful for e.g. crash reports to get to their destination.

Another use-case is for users to request an email notification for the completion of their jobs. When output data files are uploaded to the Grid, an email could be sent by default with the metadata of the file.

It can also be used to set alarms to be promptly forwarded to those subscribing to them.

class DIRAC.FrameworkSystem.Service.NotificationHandler.NotificationHandler(handlerInitDict, trid)

Bases: DIRAC.Core.DISET.RequestHandler.RequestHandler

exception ConnectionError(msg)

Bases: exceptions.Exception

__init__(msg)

x.__init__(…) initializes x; see help(type(x)) for signature

args
message
__init__(handlerInitDict, trid)

Constructor

Parameters:
  • handlerInitDict (dictionary) – Information vars for the service
  • trid (object) – Transport to use
auth_ping = ['all']
export_addNotificationForUser(user, message, lifetime=604800, deferToMail=True)

Create a group of users to be used as an assignee for an alarm

export_deleteAlarmsByAlarmId(alarmsIdList)

Delete alarms by alarmId

export_deleteAlarmsByAlarmKey(alarmsKeyList)

Delete alarms by alarmId

export_deleteAssigneeGroup(groupName)

Delete an assignee group

static export_echo(data)

This method used for testing the performance of a service

export_getAlarmInfo(alarmId)

Get the extended info of an alarm

export_getAlarms(selectDict, sortList, startItem, maxItems)

Select existing alarms suitable for the Web monitoring

export_getAssigneeGroups()

Get all assignee groups and the users that belong to them

export_getAssigneeGroupsForUser(user)

Get all assignee groups and the users that belong to them

export_getNotifications(selectDict, sortList, startItem, maxItems)

Get all assignee groups and the users that belong to them

export_getUsersInAssigneeGroup(groupName)

Get users in assignee group

export_markNotificationsAsNotRead(user, notIds)

Delete an assignee group

export_markNotificationsAsRead(user, notIds)

Delete an assignee group

export_newAlarm(alarmDefinition)

Set a new alarm in the Notification database

export_ping()
export_removeNotificationsForUser(user, notIds)

Get users in assignee group

export_sendMail(address, subject, body, fromAddress, avoidSpam=False)

Send an email with supplied body to the specified address using the Mail utility.

if avoidSpam is True, then emails are first added to a set so that duplicates are removed, and sent every hour.

export_sendSMS(userName, body, fromAddress)

Send an SMS with supplied body to the specified DIRAC user using the Mail utility via an SMS switch.

export_setAssigneeGroup(groupName, userList)

Create a group of users to be used as an assignee for an alarm

export_updateAlarm(updateDefinition)

update an existing alarm in the Notification database

classmethod getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
initialize()

Initialize this instance of the handler (to be overwritten)

classmethod initializeNotificationHandler(serviceInfo)

Handler initialization

srv_disconnect(trid=None)
classmethod srv_disconnectClient(trid)
srv_getActionTuple()
classmethod srv_getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
srv_getClientSetup()
srv_getClientVO()
srv_getFormattedRemoteCredentials()
classmethod srv_getMonitor()
srv_getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
srv_getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
classmethod srv_getServiceName()
srv_getTransportID()
classmethod srv_getURL()
classmethod srv_msgCreate(msgName)
srv_msgReply(msgObj)
classmethod srv_msgSend(trid, msgObj)
transfer_bulkFromClient(bulkId, token, bulkSize, fileHelper)
transfer_bulkToClient(bulkId, token, fileHelper)
transfer_fromClient(fileId, token, fileSize, fileHelper)
transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileId, token, fileHelper)
types_addNotificationForUser = [<type 'basestring'>, <type 'basestring'>]
types_deleteAlarmsByAlarmId = [(<type 'list'>, <type 'int'>)]
types_deleteAlarmsByAlarmKey = [(<type 'basestring'>, <type 'list'>)]
types_deleteAssigneeGroup = [<type 'basestring'>]
types_echo = [<type 'basestring'>]
types_getAlarmInfo = [(<type 'int'>, <type 'long'>)]
types_getAlarms = [<type 'dict'>, <type 'list'>, <type 'int'>, <type 'int'>]
types_getAssigneeGroups = []
types_getAssigneeGroupsForUser = [<type 'basestring'>]
types_getNotifications = [<type 'dict'>, <type 'list'>, <type 'int'>, <type 'int'>]
types_getUsersInAssigneeGroup = [<type 'basestring'>]
types_markNotificationsAsNotRead = [<type 'basestring'>, <type 'list'>]
types_markNotificationsAsRead = [<type 'basestring'>, <type 'list'>]
types_newAlarm = [<type 'dict'>]
types_ping = []
types_removeNotificationsForUser = [<type 'basestring'>, <type 'list'>]
types_sendMail = [<type 'basestring'>, <type 'basestring'>, <type 'basestring'>, <type 'basestring'>, <type 'bool'>]
types_sendSMS = [<type 'basestring'>, <type 'basestring'>, <type 'basestring'>]
types_setAssigneeGroup = [<type 'basestring'>, <type 'list'>]
types_updateAlarm = [<type 'dict'>]
DIRAC.FrameworkSystem.Service.NotificationHandler.purgeDelayedEMails()

purges the emails accumulated in gMailSet