Skip to content

Commit fcfb1ee

Browse files
committed
added a variable called file_date_limit in sr_config.py. default value = 60 days, but can be changed in config file to anything else. (value no longer hardcoded) #366
1 parent 8dcab47 commit fcfb1ee

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

sarra/sr_config.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ def declare_option(self,option):
658658

659659
def defaults(self):
660660
self.logger.debug("sr_config defaults")
661-
661+
self.file_time_limit = 60
662662
self.retry_mode = True
663663
self.retry_ttl = None
664664

@@ -1592,7 +1592,8 @@ def option(self,words):
15921592

15931593
self.logger.debug("Masks")
15941594
self.logger.debug("Masks %s"% self.masks)
1595-
1595+
elif words0 =='file_date_limit':
1596+
self.file_date_limit = words1
15961597
elif words0 in ['accept_unmatched','accept_unmatch','au']: # See: sr_config.7
15971598
if (words1 is None) or words[0][0:1] == '-' :
15981599
self.accept_unmatch = True

sarra/sr_poll.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def _file_date_exceed_limit(self, date, date_limit):
154154
assign appropriate year (for jan-jun -> assign prev year, for jul-dec assign current year)
155155
Note: is it possible for a file to be more than 6 months old and have the format Mo Day TIME ? (problematic)
156156
"""
157+
date_limit=int(date_limit)
157158
current_date = datetime.datetime.now()
158159
try:
159160
date_temp = datetime.datetime.strptime(date, '%d %b %H:%M')
@@ -214,8 +215,7 @@ def differ_ls_file(self, ls, lspath):
214215
# this format could change depending on plugin
215216
# line_mode.py format "-rwxrwxr-x 1 1000 1000 8123 24 Mar 22:54 2017-03-25-0254-CL2D-AUTO-minute-swob.xml"
216217
date = str2[5] + " " + str2[6] + " " + str2[7]
217-
218-
if self._file_date_exceed_limit(date, 60):
218+
if self._file_date_exceed_limit(date, self.file_date_limit):
219219
self.logger.info("File should be processed")
220220
# execute rest of code
221221
# keep a newer entry
@@ -232,7 +232,7 @@ def differ_ls_file(self, ls, lspath):
232232
desclst[f] = ls[f]
233233
continue
234234
else:
235-
self.logger.info("File should be skiped")
235+
self.logger.info("File should be skipped")
236236
# ignore rest of code and re iterate
237237
except:
238238
pass

0 commit comments

Comments
 (0)