def classical_split_filter(srcs, srcfilter, gsims, params, monitor): """ Split the given sources, filter the subsources and the compute the PoEs. Yield back subtasks if the split sources contain more than maxweight ruptures. """ # first check if we are sampling the sources ss = int(os.environ.get('OQ_SAMPLE_SOURCES', 0)) if ss: splits, stime = split_sources(srcs) srcs = random_filtered_sources(splits, srcfilter, ss) yield classical(srcs, srcfilter, gsims, params, monitor) return # NB: splitting all the sources improves the distribution significantly, # compared to splitting only the big source sources = [] with monitor("filtering/splitting sources"): for src, _sites in srcfilter(srcs): splits, _stime = split_sources([src]) sources.extend(srcfilter.filter(splits)) if sources: yield from parallel.split_task(classical, sources, srcfilter, gsims, params, monitor, duration=params['task_duration'])
def start_ebrisk(rupgetter, srcfilter, param, monitor): """ Launcher for ebrisk tasks """ rupgetters = rupgetter.split(srcfilter) if rupgetters: yield from parallel.split_task(ebrisk, rupgetters, srcfilter, param, monitor, duration=param['task_duration'])
def classical_split_filter(srcs, srcfilter, gsims, params, monitor): """ Split the given sources, filter the subsources and the compute the PoEs. Yield back subtasks if the split sources contain more than maxweight ruptures. """ # first check if we are sampling the sources ss = int(os.environ.get('OQ_SAMPLE_SOURCES', 0)) if ss: splits, stime = split_sources(srcs) srcs = readinput.random_filtered_sources(splits, srcfilter, ss) yield classical(srcs, srcfilter, gsims, params, monitor) return # NB: splitting all the sources improves the distribution significantly, # compared to splitting only the big source sources = [] with monitor("filtering/splitting sources"): for src, _sites in srcfilter(srcs): splits, _stime = split_sources([src]) sources.extend(srcfilter.filter(splits)) if sources: tot = 0 sd = AccumDict(accum=numpy.zeros(3)) # nsites, nrupts, weight for src in sources: arr = numpy.array([src.nsites, src.num_ruptures, src.weight]) sd[src.id] += arr tot += 1 source_data = numpy.array([(monitor.task_no, src_id, s / tot, r, w) for src_id, (s, r, w) in sd.items()], source_data_dt) first = True for out in parallel.split_task(classical, sources, srcfilter, gsims, params, monitor, duration=params['task_duration'], weight=nrup): if first: out['source_data'] = source_data first = False yield out