Esempio n. 1
0
 def test_default_backend(self):
     """ipyparallel.register_joblib_backend() registers default backend"""
     ipp.register_joblib_backend()
     with mock.patch.object(ipp.Client, "__new__",
                            lambda *a, **kw: self.client):
         p = Parallel(backend='ipyparallel')
         assert p._backend._view.client is self.client
Esempio n. 2
0
 def test_default_backend(self):
     """ipyparallel.register_joblib_backend() registers default backend"""
     ipp.register_joblib_backend()
     with mock.patch('ipyparallel.Client', lambda : self.client):
         p = Parallel(backend='ipyparallel')
         assert p._backend._view.client is self.client
     
     self.client[:].use_pickle()
Esempio n. 3
0
 def test_default_backend(self):
     """ipyparallel.register_joblib_backend() registers default backend"""
     ipp.register_joblib_backend()
     with mock.patch('ipyparallel.Client', lambda : self.client):
         p = Parallel(backend='ipyparallel')
         assert p._backend._view.client is self.client
     
     self.client[:].use_pickle()
Esempio n. 4
0
 def test_default_backend(self):
     """ipyparallel.register_joblib_backend() registers default backend"""
     ipp.register_joblib_backend()
     with mock.patch('ipyparallel.Client', lambda : self.client):
         p = Parallel(backend='ipyparallel')
         assert p._backend._view.client is self.client
     
     # FIXME: add View.use_pickle to undo use_cloudpickle
     def _restore_default_pickle():
         import pickle
         from ipyparallel.serialize import canning, serialize
         canning.pickle = serialize.pickle = pickle
         canning.can_map[canning.FunctionType] = canning.CannedFunction
     
     _restore_default_pickle()
     self.client[:].apply_sync(_restore_default_pickle)
Esempio n. 5
0
Options:
    -h --help   Show this screen.

"""

from docopt import docopt
import numpy as np
import pandas as pd
import sqlite3
from joblib import Parallel, delayed
from pathlib import Path
from tqdm import trange
import pycabnn
import ipyparallel as ipp

ipp.register_joblib_backend()


def main(db, nblocks, ntargets):
    # c = conn.cursor()
    # c.execute('SELECT MAX(target) FROM connection')
    # ntargets, = c.fetchone()
    # print(ntargets)

    prefix = Path(db).resolve()
    prefix = str(prefix.parent / prefix.stem)

    def sqlite3_ffetch(k):
        with sqlite3.connect(db) as conn:
            df = pd.read_sql_query(
                "SELECT * FROM connection WHERE target={}".format(k), conn)