Skip to content
Snippets Groups Projects
Commit 76788e97 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #8887: improved publishing of task status change notifications

parent 62c935cd
No related branches found
No related tags found
No related merge requests found
......@@ -141,10 +141,10 @@ class ResourceAssigner():
if claimed:
self.radbrpc.updateTaskAndResourceClaims(taskId, claim_status='allocated')
self.radbrpc.updateTask(taskId, status='scheduled')
self.raPublisher.notifyTaskSpecified(taskId, status='scheduled')
self.raPublisher.notifyTaskStatusChanged(taskId, momId, sasId, 'scheduled')
else:
self.radbrpc.updateTask(taskId, status='conflict')
self.raPublisher.notifyTaskSpecified(taskId, status='conflict')
self.raPublisher.notifyTaskStatusChanged(taskId, momId, sasId, 'conflict')
try:
predecessor_ids = [int(id) for id in parsets.keys() if id != str(sasId)]
......
......@@ -6,6 +6,7 @@ DEFAULT_SERVICENAME = 'RAService'
RA_NOTIFICATION_BUSNAME='lofar.ra.notification'
RA_NOTIFICATION_PREFIX='RA.'
RA_NOTIFICATION_SUBJECTS=RA_NOTIFICATION_PREFIX+'*'
try:
from lofar.sas.resourceassignment.rataskspecified.config import DEFAULT_NOTIFICATION_BUSNAME as RATASKSPECIFIED_NOTIFICATION_BUSNAME
......
......@@ -56,9 +56,9 @@ class RAPublisher():
def close(self):
self.tobus.close()
def notifyTaskSpecified(self, taskId, status):
content = { 'task_id' : taskId, 'status' : status }
logger.info('notifyTaskSpecified: %s' % content)
msg = EventMessage(context=self.notification_prefix + 'TaskSpecified', content=content)
def notifyTaskStatusChanged(self, taskId, momId, otdbId, status):
content = { 'task_id':taskId, 'status':status, 'mom_id':momId, 'otdb_id':otdbId }
logger.info('notifyTaskStatusChanged: %s' % content)
msg = EventMessage(context=self.notification_prefix + 'TaskStatusChanged', content=content)
self.tobus.send(msg)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment