def add_rse(rse, deterministic=True, volatile=False, city=None, region_code=None, country_name=None, continent=None, time_zone=None, ISP=None, staging_area=False, session=None): """ Add a rse with the given location name. :param rse: the name of the new rse. :param deterministic: Boolean to know if the pfn is generated deterministically. :param volatile: Boolean for RSE cache. :param city: City for the RSE. :param region_code: The region code for the RSE. :param country_name: The country. :param continent: The continent. :param time_zone: Timezone. :param ISP: Internet service provider. :param staging_area: Staging area. :param session: The database session in use. """ new_rse = models.RSE(rse=rse, deterministic=deterministic, volatile=volatile, city=city, region_code=region_code, country_name=country_name, continent=continent, time_zone=time_zone, staging_area=staging_area, ISP=ISP, availability=7) try: new_rse.save(session=session) except IntegrityError: raise exception.Duplicate('RSE \'%(rse)s\' already exists!' % locals()) except DatabaseError as error: raise exception.RucioException(error.args) # Add rse name as a RSE-Tag add_rse_attribute(rse=rse, key=rse, value=True, session=session) # Add counter to monitor the space usage add_counter(rse_id=new_rse.id, session=session) # Add account counter rucio.core.account_counter.create_counters_for_new_rse(rse_id=new_rse.id, session=session) return new_rse.id
def add_rse(rse, deterministic=True, volatile=False, city=None, region_code=None, country_name=None, continent=None, time_zone=None, ISP=None, staging_area=False, rse_type=RSEType.DISK, longitude=None, latitude=None, ASN=None, availability=7, session=None, supported_chksums=None): """ Add a rse with the given location name. :param rse: the name of the new rse. :param deterministic: Boolean to know if the pfn is generated deterministically. :param volatile: Boolean for RSE cache. :param city: City for the RSE. :param region_code: The region code for the RSE. :param country_name: The country. :param continent: The continent. :param time_zone: Timezone. :param ISP: Internet service provider. :param staging_area: Staging area. :param rse_type: RSE type. :param latitude: Latitude coordinate of RSE. :param longitude: Longitude coordinate of RSE. :param ASN: Access service network. :param availability: Availability. :param session: The database session in use. :param supported_chksums: The checksums supported by the RSE. """ if isinstance(rse_type, str) or isinstance(rse_type, unicode): rse_type = RSEType.from_string(str(rse_type)) new_rse = models.RSE(rse=rse, deterministic=deterministic, volatile=volatile, city=city, region_code=region_code, country_name=country_name, continent=continent, time_zone=time_zone, staging_area=staging_area, ISP=ISP, availability=availability, rse_type=rse_type, longitude=longitude, latitude=latitude, ASN=ASN) try: new_rse.save(session=session) except IntegrityError: raise exception.Duplicate('RSE \'%(rse)s\' already exists!' % locals()) except DatabaseError as error: raise exception.RucioException(error.args) # Add rse name as a RSE-Tag add_rse_attribute(rse=rse, key=rse, value=True, session=session) # Add supported checksums in rse_attr_map if specified if supported_chksums: for chksum in supported_chksums: add_rse_checksum(rse=rse, chksum_name=chksum, session=session) # Add counter to monitor the space usage add_counter(rse_id=new_rse.id, session=session) # Add account counter rucio.core.account_counter.create_counters_for_new_rse(rse_id=new_rse.id, session=session) return new_rse.id