added files missed from last commit

This commit is contained in:
PatchOfScotland
2023-01-31 17:18:03 +01:00
parent 64452e3f03
commit bb7c4af1e5
2 changed files with 13 additions and 8 deletions

View File

@ -283,7 +283,6 @@ class WatchdogMonitor(BaseMonitor):
created from that pattern will be automatically updated.""" created from that pattern will be automatically updated."""
check_type(pattern, FileEventPattern) check_type(pattern, FileEventPattern)
self.remove_pattern(pattern.name) self.remove_pattern(pattern.name)
print(f"adding pattern w/ recipe {pattern.recipe}")
self.add_pattern(pattern) self.add_pattern(pattern)
def remove_pattern(self, pattern: Union[str,FileEventPattern])->None: def remove_pattern(self, pattern: Union[str,FileEventPattern])->None:

View File

@ -5,6 +5,7 @@ along with an appropriate handler for said events.
Author(s): David Marchant Author(s): David Marchant
""" """
import itertools
import nbformat import nbformat
import sys import sys
@ -103,16 +104,21 @@ class PapermillHandler(BaseHandler):
self.setup_job(event, yaml_dict) self.setup_job(event, yaml_dict)
else: else:
# If parameter sweeps, then many jobs created # If parameter sweeps, then many jobs created
values_dict = {}
for var, val in rule.pattern.sweep.items(): for var, val in rule.pattern.sweep.items():
values = [] values_dict[var] = []
par_val = rule.pattern.sweep[SWEEP_START] par_val = val[SWEEP_START]
while par_val <= rule.pattern.sweep[SWEEP_STOP]: while par_val <= val[SWEEP_STOP]:
values.append(par_val) values_dict[var].append((var, par_val))
par_val += rule.pattern.sweep[SWEEP_JUMP] par_val += val[SWEEP_JUMP]
# combine all combinations of sweep values
values_list = list(itertools.product(
*[v for v in values_dict.values()]))
for values in values_list:
for value in values: for value in values:
yaml_dict[var] = value yaml_dict[value[0]] = value[1]
self.setup_job(event, yaml_dict) self.setup_job(event, yaml_dict)
def valid_event_types(self)->list[str]: def valid_event_types(self)->list[str]:
"""Function to provide a list of the types of events this handler can """Function to provide a list of the types of events this handler can