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

Task #8887: merged feature branch back into trunk

parents e43de52a d4f2fa25
No related branches found
No related tags found
No related merge requests found
[program:momqueryservice] [program:momqueryservice]
command=/bin/bash -c 'source $LOFARROOT/lofarinit.sh;momqueryservice --busname=lofar.ra.command --servicename=momqueryservice' command=/bin/bash -c 'source $LOFARROOT/lofarinit.sh;momqueryservice'
user=lofarsys user=lofarsys
stopsignal=INT ; KeyboardInterrupt stopsignal=INT ; KeyboardInterrupt
stopasgroup=true ; bash does not propagate signals stopasgroup=true ; bash does not propagate signals
......
...@@ -132,9 +132,9 @@ class MoMDatabaseWrapper: ...@@ -132,9 +132,9 @@ class MoMDatabaseWrapper:
# TODO: make a view for this query in momdb! # TODO: make a view for this query in momdb!
query = '''SELECT project.mom2id as project_mom2id, project.name as project_name, project.description as project_description, query = '''SELECT project.mom2id as project_mom2id, project.name as project_name, project.description as project_description,
object.mom2id as object_mom2id, object.name as object_name, object.description as object_description, object.mom2objecttype as object_type, object.group_id as object_group_id object.mom2id as object_mom2id, object.id as object_mom2objectid, object.name as object_name, object.description as object_description, object.mom2objecttype as object_type, object.group_id as object_group_id
FROM mom2object as object FROM mom2object as object
inner join mom2object as project on project.id = object.ownerprojectid left join mom2object as project on project.id = object.ownerprojectid
where object.mom2id in (%s) where object.mom2id in (%s)
order by project_mom2id order by project_mom2id
''' % (ids_str,) ''' % (ids_str,)
......
...@@ -108,17 +108,21 @@ class RAtoOTDBPropagator(): ...@@ -108,17 +108,21 @@ class RAtoOTDBPropagator():
self.otdbrpc.taskSetStatus(otdb_id, 'conflict') self.otdbrpc.taskSetStatus(otdb_id, 'conflict')
def doTaskScheduled(self, ra_id, otdb_id, mom_id): def doTaskScheduled(self, ra_id, otdb_id, mom_id):
logger.info('doTaskScheduled: otdb_id=%s mom_id=%s' % (otdb_id, mom_id)) try:
if not otdb_id: logger.info('doTaskScheduled: otdb_id=%s mom_id=%s' % (otdb_id, mom_id))
logger.warning('doTaskScheduled no valid otdb_id: otdb_id=%s' % (otdb_id,)) if not otdb_id:
return logger.warning('doTaskScheduled no valid otdb_id: otdb_id=%s' % (otdb_id,))
ra_info = self.getRAinfo(ra_id) return
project = self.momrpc.getProjectDetails(mom_id) ra_info = self.getRAinfo(ra_id)
logger.info(project) project = self.momrpc.getProjectDetails(mom_id)
project_name = "_".join(project[str(mom_id)]['project_name'].split()) logger.info(project)
otdb_info = self.translator.CreateParset(otdb_id, ra_info, project_name) project_name = "_".join(project[str(mom_id)]['project_name'].split())
logger.debug("Parset info for OTDB: %s" %otdb_info) otdb_info = self.translator.CreateParset(otdb_id, ra_info, project_name)
self.setOTDBinfo(otdb_id, otdb_info, 'scheduled') logger.debug("Parset info for OTDB: %s" %otdb_info)
self.setOTDBinfo(otdb_id, otdb_info, 'scheduled')
except Exception as e:
logger.error(e)
self.doTaskConflict(ra_id, otdb_id, mom_id)
def getRAinfo(self, ra_id): def getRAinfo(self, ra_id):
info = {} info = {}
......
...@@ -115,6 +115,7 @@ def main(): ...@@ -115,6 +115,7 @@ def main():
parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging') parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
logging.getLogger('lofar.sas.resourceassignment.database.radbbuslistener').level = logging.WARN
setQpidLogLevel(logging.INFO) setQpidLogLevel(logging.INFO)
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
level=logging.DEBUG if options.verbose else logging.INFO) level=logging.DEBUG if options.verbose else logging.INFO)
......
...@@ -685,7 +685,7 @@ class RADatabase: ...@@ -685,7 +685,7 @@ class RADatabase:
(resource_claim_id, type_id, value, sap_id) (resource_claim_id, type_id, value, sap_id)
VALUES {values} VALUES {values}
RETURNING id;'''.format(values=insert_values) RETURNING id;'''.format(values=insert_values)
ids = [x['id'] for x in self._executeQuery(query, fetch=_FETCH_ALL)] ids = [x['id'] for x in self._executeQuery(query, fetch=_FETCH_ALL)]
if [x for x in ids if x < 0]: if [x for x in ids if x < 0]:
...@@ -1088,6 +1088,7 @@ class RADatabase: ...@@ -1088,6 +1088,7 @@ class RADatabase:
claimsStatuses = self.getResourceClaimStatuses() claimsStatuses = self.getResourceClaimStatuses()
conflistStatusId = next(cs['id'] for cs in claimsStatuses if cs['name'] == 'conflict') conflistStatusId = next(cs['id'] for cs in claimsStatuses if cs['name'] == 'conflict')
claimedStatusId = next(cs['id'] for cs in claimsStatuses if cs['name'] == 'claimed') claimedStatusId = next(cs['id'] for cs in claimsStatuses if cs['name'] == 'claimed')
allocatedStatusId = next(cs['id'] for cs in claimsStatuses if cs['name'] == 'allocated')
# 'result' dict for new statuses for claims # 'result' dict for new statuses for claims
newClaimStatuses = {conflistStatusId:[], claimedStatusId:[]} newClaimStatuses = {conflistStatusId:[], claimedStatusId:[]}
...@@ -1124,7 +1125,7 @@ class RADatabase: ...@@ -1124,7 +1125,7 @@ class RADatabase:
if totalOtherClaimSize + claimSize >= resource['available_capacity']: if totalOtherClaimSize + claimSize >= resource['available_capacity']:
newClaimStatuses[conflistStatusId].append(claim_id) newClaimStatuses[conflistStatusId].append(claim_id)
else: elif claim['status_id'] != allocatedStatusId:
newClaimStatuses[claimedStatusId].append(claim_id) newClaimStatuses[claimedStatusId].append(claim_id)
if newClaimStatuses: if newClaimStatuses:
......
...@@ -61,6 +61,8 @@ def updateTaskMomDetails(task, momrpc): ...@@ -61,6 +61,8 @@ def updateTaskMomDetails(task, momrpc):
t['name'] = m['object_name'] t['name'] = m['object_name']
t['project_name'] = m['project_name'] t['project_name'] = m['project_name']
t['project_mom_id'] = m['project_mom2id'] t['project_mom_id'] = m['project_mom2id']
t['mom2object_id'] = m['object_mom2objectid']
t['mom_object_group_id'] = m['object_group_id']
else: else:
t['project_name'] = 'OTDB Only' t['project_name'] = 'OTDB Only'
t['project_mom_id'] = -98 t['project_mom_id'] = -98
......
...@@ -28,7 +28,7 @@ gridControllerMod.controller('GridController', ['$scope', 'dataService', 'uiGrid ...@@ -28,7 +28,7 @@ gridControllerMod.controller('GridController', ['$scope', 'dataService', 'uiGrid
{ field: 'mom_id', { field: 'mom_id',
displayName: 'MoM ID', displayName: 'MoM ID',
enableCellEdit: false, enableCellEdit: false,
cellTemplate:'<a target="_blank" href="https://lofar.astron.nl/mom3/user/project/setUpMom2ObjectDetails.do?view=generalinfo&mom2Id={{row.entity[col.field]}}">{{row.entity[col.field]}}</a>', cellTemplate:'<a target="_blank" href="https://lofar.astron.nl/mom3/user/project/setUpMom2ObjectDetails.do?view=generalinfo&mom2ObjectId={{{{row.entity.mom2object_id}}}}">{{row.entity[col.field]}}</a>',
width: '7.5%' width: '7.5%'
}, },
{ field: 'otdb_id', { field: 'otdb_id',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment