(now returning a list).
%(slices))
if not slices:
return (sfa_slice, slivers)
- if isinstance(sfa_slice, list):
- sfa_slice = slices[0]
- else:
- sfa_slice = slices
+ #if isinstance(sfa_slice, list):
+ #sfa_slice = slices[0]
+ #else:
+ #sfa_slice = slices
# sort slivers by node id , if there is a job
#and therfore, node allocated to this slice
- if sfa_slice['oar_job_id'] is not -1:
- try:
-
- for node_id in sfa_slice['node_ids']:
- #node_id = self.driver.root_auth + '.' + node_id
- sliver = Sliver({'sliver_id': urn_to_sliver_id(slice_urn, \
- sfa_slice['record_id_slice'], node_id),
- 'name': sfa_slice['slice_hrn'],
- 'type': 'slab-node',
- 'tags': []})
- slivers[node_id] = sliver
- except KeyError:
- logger.log_exc("SLABAGGREGATE \t \
- get_slice_and_slivers KeyError ")
+ for sfa_slice in slices:
+ if sfa_slice['oar_job_id'] is not -1:
+ try:
+
+ for node_id in sfa_slice['node_ids']:
+ #node_id = self.driver.root_auth + '.' + node_id
+ sliver = Sliver({'sliver_id': urn_to_sliver_id(slice_urn, \
+ sfa_slice['record_id_slice'], node_id),
+ 'name': sfa_slice['slice_hrn'],
+ 'type': 'slab-node',
+ 'tags': []})
+ slivers[node_id] = sliver
+ except KeyError:
+ logger.log_exc("SLABAGGREGATE \t \
+ get_slice_and_slivers KeyError ")
## sort sliver attributes by node id
##tags = self.driver.GetSliceTags({'slice_tag_id': slice['slice_tag_ids']})
##for tag in tags:
#the slice record
rslt = self.GetJobsResources(slicerec_dict['oar_job_id'], \
username = login)
-
+ logger.debug("SLABDRIVER.PY \tGetSlices rslt fromn GetJobsResources %s"\
+ %(rslt))
if rslt :
slicerec_dict.update(rslt)
slicerec_dict.update({'hrn':\
str(slicerec_dict['slice_hrn'])})
- #If GetJobsResources is empty, this means the job is
- #now in the 'Terminated' state
- #Update the slice record
+ #If GetJobsResources is empty, this means the job is
+ #now in the 'Terminated' state
+ #Update the slice record
else :
self.db.update_job(slice_filter, job_id = -1)
slicerec_dict['oar_job_id'] = -1
#login_base = slice_hrn.split(".")[0]
slicename = slice_hrn
- sl = self.driver.GetSlices(slice_filter = slicename, \
+ slices_list = self.driver.GetSlices(slice_filter = slicename, \
slice_filter_type = 'slice_hrn')
- if sl:
-
- logger.debug("SLABSLICE \tverify_slice slicename %s sl %s \
- slice_record %s"%(slicename, sl, slice_record))
- sfa_slice = sl
- sfa_slice.update(slice_record)
- #del slice['last_updated']
- #del slice['date_created']
- #if peer:
- #slice['peer_slice_id'] = slice_record.get('slice_id', None)
- ## unbind from peer so we can modify if necessary.
- ## Will bind back later
- #self.driver.UnBindObjectFromPeer('slice', slice['slice_id'], \
- #peer['shortname'])
- #Update existing record (e.g. expires field)
- #it with the latest info.
- ##if slice_record and slice['expires'] != slice_record['expires']:
- ##self.driver.UpdateSlice( slice['slice_id'], {'expires' : \
- #slice_record['expires']})
+ if slices_list:
+ for sl in slices_list:
+
+ logger.debug("SLABSLICE \tverify_slice slicename %s sl %s \
+ slice_record %s"%(slicename, sl, slice_record))
+ sfa_slice = sl
+ sfa_slice.update(slice_record)
+ #del slice['last_updated']
+ #del slice['date_created']
+ #if peer:
+ #slice['peer_slice_id'] = slice_record.get('slice_id', None)
+ ## unbind from peer so we can modify if necessary.
+ ## Will bind back later
+ #self.driver.UnBindObjectFromPeer('slice', slice['slice_id'], \
+ #peer['shortname'])
+ #Update existing record (e.g. expires field)
+ #it with the latest info.
+ ##if slice_record and slice['expires'] != slice_record['expires']:
+ ##self.driver.UpdateSlice( slice['slice_id'], {'expires' : \
+ #slice_record['expires']})
else:
logger.debug(" SLABSLICES \tverify_slice Oups \
slice_record %s peer %s sfa_peer %s "\