def find_first_job(pred, packagelist, settings, molecule, job_name, **kwargs): joblist = [ package(settings, molecule, job_name=package.pkg_name + "_" + job_name, **kwargs) for package in packagelist ] return find_first(pred, joblist)
def test_find_first(): global counter wfs = [counted_sqr(x) for x in range(10)] w = find_first(is_sixteen, wfs) result = run_single(w) assert result == 16 assert counter == 5 wfs = [counted_sqr(x) for x in range(10)] w = find_first(is_sixteen, wfs) result = run_process(w, n_processes=1, registry=base) assert result == 16 wfs = [display_sqr(x) for x in range(10)] w = find_first(is_sixteen, wfs) with NCDisplay() as display: result = run_logging(w, n_threads=2, display=display) assert result == 16
def find_first_job(pred: Predicate, packagelist: Iterable[Package], settings: Settings, molecule: Molecule, job_name: str, **kwargs: Any) -> Optional[Result]: """Return the first job to finish.""" joblist = [ package(settings, molecule, job_name=f"{package.pkg_name}_{job_name}", **kwargs) for package in packagelist ] return find_first(pred, joblist)
def find_first(): wfs = [sqr(x) for x in range(10)] return noodles.find_first(is_sixteen, wfs)
def find_first_job(pred, packagelist, settings, molecule, job_name, **kwargs): joblist = [package( settings, molecule, job_name=package.pkg_name + "_" + job_name, **kwargs) for package in packagelist] return find_first(pred, joblist)