示例#1
0
def main():
    # Client('127.0.0.1:8786')  # use distributed scheduler

    if not os.path.exists('data_0.csv'):
        with timer(print, "create_csvs"):
            create_csvs(10, int(1e6), 4)

    with timer(print, "compute_mean_pandas"):
        print(compute_mean_pandas())

    with timer(print, "compute_mean_dask"):
        print(compute_mean_dask())
示例#2
0
def run_smoke_tests_with_config(config_fname, run=None, raise_errors=True,
                                func_kwargs=None):
    from palladium.util import logger  # don't break coverage
    from palladium.util import timer

    if func_kwargs is None:
        func_kwargs = {}

    print("Running functional tests for {}".format(config_fname))

    with patch.dict('os.environ', {'PALLADIUM_CONFIG': config_fname}):
        from palladium.fit import fit
        from palladium.fit import activate
        from palladium.fit import grid_search
        from palladium.eval import test
        from palladium.util import initialize_config

        failed = []

        with change_cwd(os.path.dirname(config_fname)):
            initialize_config(__mode__='fit')
            for func in (fit, activate, grid_search, test, predict):
                if run and func.__name__ not in run:
                    continue
                try:
                    this_kwargs = func_kwargs.get(func.__name__, {})
                    with timer(logger.info,
                               "Running {}".format(func.__name__)):
                        func(**this_kwargs)
                except Exception as e:
                    if raise_errors:
                        raise
                    failed.append((func.__name__, e))

    return failed
示例#3
0
def make_bridge():  # pragma: no cover
    with timer(logger.info, "Creating Julia bridge"):
        return Julia()