(Properly) Don't force-process a stopped instance.

parent 11e9955d
...@@ -745,11 +745,11 @@ class Slapgrid(object): ...@@ -745,11 +745,11 @@ class Slapgrid(object):
# Try to process it anyway, it may need to be deleted. # Try to process it anyway, it may need to be deleted.
software_path = None software_path = None
periodicity = self.maximum_periodicity
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:
periodicity = int(open(periodicity_path).read()) periodicity = int(open(periodicity_path).read())
...@@ -768,8 +768,12 @@ class Slapgrid(object): ...@@ -768,8 +768,12 @@ class Slapgrid(object):
if timestamp: if timestamp:
try: try:
if int(timestamp) <= int(old_timestamp): if int(timestamp) <= int(old_timestamp):
if int(time.time()) <= ( # Check periodicity, i.e if periodicity is one day, partition
last_runtime + periodicity) : # should be processed at least every day.
# Only do it for "started" instances
if computer_partition.getState() != COMPUTER_PARTITION_STARTED_STATE:
return
if int(time.time()) <= (last_runtime + periodicity):
self.logger.info('Partition already up-to-date, skipping.') self.logger.info('Partition already up-to-date, skipping.')
return return
except ValueError: except ValueError:
......
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