[109] Merge branch 'refs/heads/tckelly38/nightly' into nightly

pull/1612/head
meisnate12 1 year ago
commit 81368cd6bf

@ -14,10 +14,10 @@ The scheduling options are:
|:-------------|:-----------------------------------------------------------------------------------------------------------|:---------------------------------------------------|:-------------------------------------------------------------| |:-------------|:-----------------------------------------------------------------------------------------------------------|:---------------------------------------------------|:-------------------------------------------------------------|
| Hourly | Update only when the script is run in that hour or hour range | hourly(Hour of Day)<br>hourly(Start Hour-End Hour) | `hourly(17)`<br>`hourly(17-04)` | | Hourly | Update only when the script is run in that hour or hour range | hourly(Hour of Day)<br>hourly(Start Hour-End Hour) | `hourly(17)`<br>`hourly(17-04)` |
| Daily | Update once a day | daily | `daily` | | Daily | Update once a day | daily | `daily` |
| Weekly | Update once a week on the specified days (For multiple days use a bar-separated (<code>&#124;</code>) list | weekly(Days of Week) | `weekly(sunday)`<br><code>weekly(sunday&#124;tuesday)</code> | | Weekly | Update once a week on the specified days (For multiple days, use a bar-separated (<code>&#124;</code>) list)| weekly(Days of Week) | `weekly(sunday)`<br><code>weekly(sunday&#124;tuesday)</code> |
| Monthly | Update once a month on the specified day | monthly(Day of Month) | `monthly(1)` | | Monthly | Update once a month on the specified day | monthly(Day of Month) | `monthly(1)` |
| Yearly | Update once a year on the specified day | yearly(MM/DD) | `yearly(01/30)` | | Yearly | Update once a year on the specified day | yearly(MM/DD) | `yearly(01/30)` |
| Range | Updates whenever the date is within the range | range(MM/DD-MM/DD) | `range(12/01-12/31)` | | Range | Updates whenever the date is within the range (For mulitple ranges, use a bar-separated (`\|`) list) | range(MM/DD-MM/DD) | `range(12/01-12/31)`<br>`range(8/01-8/15\|9/01-9/15)` |
| Never | Never updates | never | `never` | | Never | Never updates | never | `never` |
| Non Existing | Updates if it doesn't exist | non_existing | `non_existing` | | Non Existing | Updates if it doesn't exist | non_existing | `non_existing` |
| All | Requires that all comma separated scheduling options inside its brackets be meet in order to run | all[Options] | `all[weekly(sunday), hourly(17)]` | | All | Requires that all comma separated scheduling options inside its brackets be meet in order to run | all[Options] | `all[weekly(sunday), hourly(17)]` |

@ -669,20 +669,23 @@ def schedule_check(attribute, data, current_time, run_hour, is_all=False):
except ValueError: except ValueError:
logger.error(f"Schedule Error: yearly {display} must be in the MM/DD format i.e. yearly(11/22)") logger.error(f"Schedule Error: yearly {display} must be in the MM/DD format i.e. yearly(11/22)")
elif run_time.startswith("range"): elif run_time.startswith("range"):
match = re.match("^(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])-(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])$", param) ok_ranges = param.lower().split("|")
if not match: err = None
logger.error(f"Schedule Error: range {display} must be in the MM/DD-MM/DD format i.e. range(12/01-12/25)") for ok_range in ok_ranges:
continue match = re.match("^(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])-(1[0-2]|0?[1-9])/(3[01]|[12][0-9]|0?[1-9])$", ok_range)
month_start, day_start = check_day(int(match.group(1)), int(match.group(2))) if not match:
month_end, day_end = check_day(int(match.group(3)), int(match.group(4))) logger.error(f"Schedule Error: range {display} must be in the MM/DD-MM/DD format i.e. range(12/01-12/25)")
month_check, day_check = check_day(current_time.month, current_time.day) continue
check = datetime.strptime(f"{month_check}/{day_check}", "%m/%d") month_start, day_start = check_day(int(match.group(1)), int(match.group(2)))
start = datetime.strptime(f"{month_start}/{day_start}", "%m/%d") month_end, day_end = check_day(int(match.group(3)), int(match.group(4)))
end = datetime.strptime(f"{month_end}/{day_end}", "%m/%d") month_check, day_check = check_day(current_time.month, current_time.day)
range_collection = True check = datetime.strptime(f"{month_check}/{day_check}", "%m/%d")
schedule_str += f"\nScheduled between {pretty_months[month_start]} {num2words(day_start, to='ordinal_num')} and {pretty_months[month_end]} {num2words(day_end, to='ordinal_num')}" start = datetime.strptime(f"{month_start}/{day_start}", "%m/%d")
if start <= check <= end if start < end else (check <= end or check >= start): end = datetime.strptime(f"{month_end}/{day_end}", "%m/%d")
all_check += 1 range_collection = True
schedule_str += f"\nScheduled between {pretty_months[month_start]} {num2words(day_start, to='ordinal_num')} and {pretty_months[month_end]} {num2words(day_end, to='ordinal_num')}"
if start <= check <= end if start < end else (check <= end or check >= start):
all_check += 1
else: else:
logger.error(f"Schedule Error: {display}") logger.error(f"Schedule Error: {display}")
if is_all: if is_all:

Loading…
Cancel
Save