Skip to content

Commit

Permalink
Core & Internals: Added properties to add_rse; Fix rucio#1646
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahannes committed Oct 16, 2018
1 parent 04907e2 commit 88af637
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/rucio/api/rse.py
Expand Up @@ -25,7 +25,7 @@

def add_rse(rse, issuer, deterministic=True, volatile=False, city=None, region_code=None,
country_name=None, continent=None, time_zone=None, ISP=None,
staging_area=False):
staging_area=False, type=None, latitude=None, longitude=None):
"""
Creates a new Rucio Storage Element(RSE).
Expand All @@ -40,6 +40,9 @@ def add_rse(rse, issuer, deterministic=True, volatile=False, city=None, region_c
:param time_zone: Timezone.
:param staging_area: staging area.
:param ISP: Internet service provider.
:param type: RSE type.
:param latitude: GPS latitude.
:param longitude: GPS longitude.
"""
validate_schema(name='rse', obj=rse)
kwargs = {'rse': rse}
Expand All @@ -48,7 +51,8 @@ def add_rse(rse, issuer, deterministic=True, volatile=False, city=None, region_c

return rse_module.add_rse(rse, deterministic=deterministic, volatile=volatile, city=city,
region_code=region_code, country_name=country_name, staging_area=staging_area,
continent=continent, time_zone=time_zone, ISP=ISP)
continent=continent, time_zone=time_zone, ISP=ISP, type=type, latitude=latitude,
longitude=longitude)


def get_rse(rse):
Expand Down
3 changes: 3 additions & 0 deletions lib/rucio/client/rseclient.py
Expand Up @@ -78,6 +78,9 @@ def add_rse(self, rse, **kwargs):
:param time_zone: Timezone.
:param staging_area: Staging area.
:param ISP: Internet service provider.
:param type: RSE type.
:param latitude: GPS latitude.
:param longitude: GPS longitude.
:return: True if location was created successfully else False.
:raises Duplicate: if rse already exists.
Expand Down
11 changes: 9 additions & 2 deletions lib/rucio/core/rse.py
Expand Up @@ -59,7 +59,7 @@


@transactional_session
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):
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, type=None, longitude=None, latitude=None, session=None):
"""
Add a rse with the given location name.
Expand All @@ -73,11 +73,18 @@ def add_rse(rse, deterministic=True, volatile=False, city=None, region_code=None
:param time_zone: Timezone.
:param ISP: Internet service provider.
:param staging_area: Staging area.
:param type: RSE type.
:param latitude: GPS latitude.
:param longitude: GPS longitude.
:param session: The database session in use.
"""
if isinstance(type, str) or isinstance(type, unicode):
type = RSEType.from_sym(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=7)
continent=continent, time_zone=time_zone, staging_area=staging_area, ISP=ISP, availability=7,
rse_type=type, latitude=latitude, longitude=longitude)
try:
new_rse.save(session=session)
except IntegrityError:
Expand Down
6 changes: 5 additions & 1 deletion lib/rucio/web/rest/flaskapi/v1/rse.py
Expand Up @@ -101,6 +101,9 @@ def post(self, rse):
:<json string continent: The continent.
:<json string time_zone: Timezone.
:<json string ISP: Internet Service Provider.
:<json string type: RSE type.
:<json float latitude: GPS latitude.
:<json float longitude: GPS longitude.
:status 201: RSE created successfully.
:status 400: Cannot decode json parameter dictionary.
:status 401: Invalid Auth Token.
Expand All @@ -113,7 +116,8 @@ def post(self, rse):
kwargs = {'deterministic': True,
'volatile': False, 'city': None, 'staging_area': False,
'region_code': None, 'country_name': None,
'continent': None, 'time_zone': None, 'ISP': None}
'continent': None, 'time_zone': None, 'ISP': None,
'type' None, 'latitude': None, 'longitude': None}
try:
parameters = json_data and loads(json_data)
if parameters:
Expand Down
3 changes: 2 additions & 1 deletion lib/rucio/web/rest/webpy/v1/rse.py
Expand Up @@ -119,7 +119,8 @@ def POST(self, rse):
kwargs = {'deterministic': True,
'volatile': False, 'city': None, 'staging_area': False,
'region_code': None, 'country_name': None,
'continent': None, 'time_zone': None, 'ISP': None}
'continent': None, 'time_zone': None, 'ISP': None,
'type': None, 'latitude': None, 'longitude': None}
try:
parameters = json_data and loads(json_data)
if parameters:
Expand Down

0 comments on commit 88af637

Please sign in to comment.