diff --git a/SAS/ResourceAssignment/ResourceAssignmentEstimator/resource_estimators/reservation.py b/SAS/ResourceAssignment/ResourceAssignmentEstimator/resource_estimators/reservation.py index 7b1bc56e49d83eec531c3d7ea956f1ee92405a06..84b3b5bcdc9e16d62c2862ddf82982548e407112 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEstimator/resource_estimators/reservation.py +++ b/SAS/ResourceAssignment/ResourceAssignmentEstimator/resource_estimators/reservation.py @@ -36,30 +36,9 @@ class ReservationResourceEstimator(BaseResourceEstimator): def __init__(self): logger.info("init ReservationResourceEstimator") super(ReservationResourceEstimator, self).__init__(name='reservation') - self.required_keys = (#'Observation.sampleClock', # todo: do we really only reserve station resources? - 'Observation.startTime', + self.required_keys = ('Observation.startTime', 'Observation.stopTime', - # 'Observation.antennaSet', - # 'Observation.nrBeams', - # 'Observation.Beam[0].subbandList', - # 'Observation.nrBitsPerSample', 'Observation.VirtualInstrument.stationList', - # COBALT + 'Correlator.nrChannelsPerSubband', - # COBALT + 'Correlator.integrationTime', - # COBALT + 'BeamFormer.flysEye', - # COBALT + 'BeamFormer.CoherentStokes.timeIntegrationFactor', - # COBALT + 'BeamFormer.IncoherentStokes.timeIntegrationFactor', - # DATAPRODUCTS + 'Output_Correlated.enabled', - # DATAPRODUCTS + 'Output_Correlated.identifications', - # DATAPRODUCTS + 'Output_Correlated.storageClusterName', - # DATAPRODUCTS + 'Output_CoherentStokes.enabled', - # DATAPRODUCTS + 'Output_CoherentStokes.identifications', - # DATAPRODUCTS + 'Output_CoherentStokes.storageClusterName', - # COBALT + 'BeamFormer.CoherentStokes.which', - # DATAPRODUCTS + 'Output_IncoherentStokes.enabled', - # DATAPRODUCTS + 'Output_IncoherentStokes.identifications', - # DATAPRODUCTS + 'Output_IncoherentStokes.storageClusterName', - # COBALT + 'BeamFormer.IncoherentStokes.which' ) self.asp = AntennaSetsParser() @@ -102,10 +81,10 @@ class ReservationResourceEstimator(BaseResourceEstimator): rculists = self.asp.get_receiver_units_configuration_per_station(antennaset, stationset) for station in stationset: - bitfield, count = self._rculist_to_bitfield(rculists[station]) + rsps, channelbits = self._max_rsps(station) - bitfield = len(bitfield)*'1' # claim all RCUs irrespective, we actually only need the AntennasetsParser to obatin the numbe rof RCUs + bitfield = len(rculists[station])*'1' # claim all RCUs irrespective of use in given antennaset, we actually only need the AntennasetsParser to obatin the numbe rof RCUs est = {'resource_types': {'rcu': bitfield}, 'resource_count': 1, @@ -125,23 +104,6 @@ class ReservationResourceEstimator(BaseResourceEstimator): return estimates - def _rculist_to_bitfield(self, rculist): - """ - Takes list of rcus as returned by Antennasets_parser ['LBL', 'LBH', None, ...] and encodes them as a bitfield. - Each bit represents one rcu, value is 1 if rcu is not None in input list (= is used), 0 otherwise. - Returns String representation of the bitfield and the number of used rcus. - """ - bitfield = "" - count = 0 - for rcu in rculist: - if rcu is None: - bitfield = bitfield+"0" - else: - bitfield = bitfield+"1" - count = count + 1 - - return bitfield, count - def _max_rsps(self, station): """ Takes station name and list of antennafields. diff --git a/SAS/ResourceAssignment/ResourceAssignmentEstimator/service.py b/SAS/ResourceAssignment/ResourceAssignmentEstimator/service.py index 9f0b66f5de01a36027ff55e44a0ee15d8ab27d61..cc1fc4a7a95caa4ef23b77eb627201c3665da22a 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentEstimator/service.py +++ b/SAS/ResourceAssignment/ResourceAssignmentEstimator/service.py @@ -117,7 +117,7 @@ class ResourceEstimatorHandler(MessageHandlerInterface): return {str(otdb_id): self.add_id(self.pulsar_pipeline.verify_and_estimate(parset, input_files), otdb_id)} elif specification_tree['task_type'] == 'reservation': return {str(otdb_id): self.add_id(self.reservation.verify_and_estimate(parset), otdb_id)} - else: # reservation, maintenance, system tasks? + else: # system tasks? logger.warning("ID %s is not a pipeline, observation or reservation." % otdb_id) return {str(otdb_id): {specification_tree['task_type']: {'errors': ["ID %s is not a pipeline, observation or reservation." % otdb_id]}}}