Commit fe704b5a authored by Mihai Patrascoiu's avatar Mihai Patrascoiu
Browse files

FTS-1728: Request submissions provide a minimum configurable time delta...

FTS-1728: Request submissions provide a minimum configurable time delta between bringonline and expiration timeout
parent 5a95cdf0
Pipeline #3040726 passed with stage
in 2 minutes and 20 seconds
...@@ -294,6 +294,8 @@ def _seconds_from_value(value): ...@@ -294,6 +294,8 @@ def _seconds_from_value(value):
return int(value) * 60 return int(value) * 60
elif suffix == 'h': elif suffix == 'h':
return int(value) * 3600 return int(value) * 3600
elif suffix == 'd':
return int(value) * 3600 * 24
else: else:
return None return None
except: except:
...@@ -492,6 +494,15 @@ class JobBuilder(object): ...@@ -492,6 +494,15 @@ class JobBuilder(object):
if max_time_in_queue is not None: if max_time_in_queue is not None:
expiration_time = time.time() + max_time_in_queue expiration_time = time.time() + max_time_in_queue
if max_time_in_queue is not None and self.params['bring_online'] > 0:
# Ensure that the bringonline and expiration delta is respected
timeout_delta = _seconds_from_value(
pylons.config.get('fts3.BringOnlineAndExpirationDelta', None))
if timeout_delta is not None:
log.debug("Will enforce BringOnlineAndExpirationDelta=" + str(timeout_delta) + "s")
if max_time_in_queue - self.params['bring_online'] < timeout_delta:
raise HTTPBadRequest('Bringonline and Expiration timeout must be at least ' + str(timeout_delta) + ' seconds apart')
if self.params['overwrite']: if self.params['overwrite']:
overwrite_flag = 'Y' overwrite_flag = 'Y'
elif self.params['overwrite_on_retry']: elif self.params['overwrite_on_retry']:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment