Commit 06c5d122 authored by Paul Rich's avatar Paul Rich
Browse files

Fix for the aggressive cleanup

The apid fetch wasn't restricting itself to the actual ALPS reservation.
This was causing everything to get killed.
parent d9595cc8
......@@ -1275,23 +1275,24 @@ class ALPSReservation(object):
# fetch reservation information so that we can send kills to
# interactive apruns.
resinfo = ALPSBridge.fetch_reservations()
apids = _find_non_batch_apids(resinfo['reservations'])
apids = _find_non_batch_apids(resinfo['reservations'], self.alps_res_id)
else:
_logger.info('ALPS reservation: %s has no claims left.',
self.alps_res_id)
self.dying = True
return apids
def _find_non_batch_apids(resinfo):
def _find_non_batch_apids(resinfo, alps_res_id=None):
'''Extract apids from non-batch items.'''
apids = []
for alps_res in resinfo:
#wow, this is ugly.
for applications in alps_res['ApplicationArray']:
for application in applications.values():
for app_data in application:
for commands in app_data['CommandArray']:
for command in commands.values():
if command[0]['cmd'] != 'BASIL':
apids.append(app_data['application_id'])
if alps_res_id is None or alps_res['reservation_id'] == str(alps_res_id):
#wow, this is ugly.
for applications in alps_res['ApplicationArray']:
for application in applications.values():
for app_data in application:
for commands in app_data['CommandArray']:
for command in commands.values():
if command[0]['cmd'] != 'BASIL':
apids.append(app_data['application_id'])
return apids
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment