From 9129c9ef053b1fceb9b802fc61f1fc92939ef4da Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 25 Jan 2012 11:24:50 +0100 Subject: [PATCH] GetSlices fix 1. --- sfa/senslab/slabdriver.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/sfa/senslab/slabdriver.py b/sfa/senslab/slabdriver.py index a3d96e3c..7ca3e796 100644 --- a/sfa/senslab/slabdriver.py +++ b/sfa/senslab/slabdriver.py @@ -411,26 +411,33 @@ class SlabDriver(Driver): return_slice_list =[] sliceslist = self.db.find('slice',columns = ['oar_job_id', 'slice_hrn', 'record_id_slice','record_id_user'], record_filter=slice_filter) - print >>sys.stderr, " \r\n \r\n SLABDRIVER.PY GetSlices slices %s slice_filter %s " %(sliceslist,slice_filter) - #slicesdict = sliceslist[0] + + print >>sys.stderr, " \r\n \r\n \tSLABDRIVER.PY GetSlices slices %s slice_filter %s " %(sliceslist,slice_filter) + if not (slice_filter or return_fields) and sliceslist: for sl in sliceslist: if sl['oar_job_id'] is not -1: rslt = self.GetJobs( sl['oar_job_id'],resources=False) - print >>sys.stderr, " \r\n \r\n SLABRIVER.PY GetSlices rslt %s" %(rslt) + print >>sys.stderr, " \r\n \r\n \tSLABRIVER.PY GetSlices rslt %s" %(rslt) + if rslt : sl.update(rslt) + sl.update({'hrn':str(sl['slice_hrn'])}) + print >>sys.stderr, " \r\n \r\n \tSLABDRIVER.PY GetSlices slice SL %s" %(sl) #If GetJobs is empty, this means the job is now in the 'Terminated' state #Update the slice record - else: + else : sl['oar_job_id'] = '-1' sl.update({'hrn':str(sl['slice_hrn'])}) - print >>sys.stderr, " \r\n \r\n SLABDRIVER.PY GetSlices TERMINATEDDFDDDDD %s" %(sl) - self.db.update_senslab_slice(sl) + print >>sys.stderr, " \r\n \r\n \tSLABDRIVER.PY GetSlices TERMINATEDDFDDDDD %s" %(sl) + self.db.update_senslab_slice(sl) + + return_slice_list = sliceslist + print >>sys.stderr, " \r\n \r\n \tSLABDRIVER.PY GetSlices return_slice_list %s" %(return_slice_list) return return_slice_list return_slice_list = parse_filter(sliceslist, slice_filter,'slice', return_fields) @@ -441,7 +448,19 @@ class SlabDriver(Driver): print >>sys.stderr, " \r\n \r\n SLABDRIVER.PY GetSlices sl %s" %(sl) rslt =self.GetJobs( sl['oar_job_id'],resources=False) print >>sys.stderr, " \r\n \r\n SLABRIVER.PY GetSlices rslt %s" %(rslt) - sl.update(rslt) + if rslt : + sl.update(rslt) + sl.update({'hrn':str(sl['slice_hrn'])}) + print >>sys.stderr, " \r\n \r\n \tSLABDRIVER.PY GetSlices slice SL %s" %(sl) + #If GetJobs is empty, this means the job is now in the 'Terminated' state + #Update the slice record + else : + sl['oar_job_id'] = '-1' + + sl.update({'hrn':str(sl['slice_hrn'])}) + print >>sys.stderr, " \r\n \r\n \tSLABDRIVER.PY GetSlices TERMINATEDDFDDDDD %s" %(sl) + self.db.update_senslab_slice(sl) + #print >>sys.stderr, " \r\n \r\n SLABDRIVER.PY GetSlices return_slice_list %s" %(return_slice_list) return return_slice_list -- 2.43.0