Parsing CLI option for runtime limit, supplied as VALUE.
Value could be something like: Sunday 23:00-05:00, the format being
[Wee[kday]] [hh[:mm][-hh[:mm]]].
The function will return two valid time ranges. The first could be in the past, containing the present or in the future. The second is always in the future.
progress=run_sql("SELECT progress FROM schTASK WHERE id=%s",(_TASK_PARAMS['task_id'],))
ifprogress:
progress=progress[0][0]
else:
progress=''
g=re.match(r'Postponed (\d+) time\(s\)',progress)
ifg:
postponed_times=int(g.group(1))
else:
postponed_times=0
run_sql("UPDATE schTASK SET runtime=%s, status='WAITING', progress=%s WHERE id=%s",(new_runtime,'Postponed %d time(s)'%(postponed_times+1),_TASK_PARAMS['task_id']))
write_message("Task #%d postponed because outside of runtime limit"%_TASK_PARAMS['task_id'])