Commit e9c5f928 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Merge branch 'periodicity'

Conflicts:
	slapos/grid/slapgrid.py
	slapos/tests/slapgrid.py

Add periodicity and factored tests
parents d51c8373 13838976
...@@ -659,11 +659,12 @@ class Slapgrid(object): ...@@ -659,11 +659,12 @@ class Slapgrid(object):
if software_path: if software_path:
# Get periodicity from periodicity file if not forced # Get periodicity from periodicity file if not forced
periodicity = self.maximum_periodicity
if not self.force_periodicity: if not self.force_periodicity:
periodicity_path = os.path.join(software_path,'periodicity') periodicity_path = os.path.join(software_path,'periodicity')
if os.path.exists(periodicity_path): if os.path.exists(periodicity_path):
try: try:
self.maximum_periodicity = int(open(periodicity_path).read()) periodicity = int(open(periodicity_path).read())
except ValueError: except ValueError:
os.remove(periodicity_path) os.remove(periodicity_path)
exception = traceback.format_exc() exception = traceback.format_exc()
...@@ -680,7 +681,7 @@ class Slapgrid(object): ...@@ -680,7 +681,7 @@ class Slapgrid(object):
try: try:
if int(timestamp) <= int(old_timestamp): if int(timestamp) <= int(old_timestamp):
if int(time.time()) <= ( if int(time.time()) <= (
last_runtime + self.maximum_periodicity) : last_runtime + periodicity) :
return return
except ValueError: except ValueError:
os.remove(timestamp_path) os.remove(timestamp_path)
......
This diff is collapsed.
Markdown is supported
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