/usr/local/lib/python3.6/site-packages/joblib/__pycache__
NameSizeModeActions
backports.cpython-36.pyc25550644editdlrm
compressor.cpython-36.pyc166160644editdlrm
disk.cpython-36.pyc30500644editdlrm
executor.cpython-36.pyc31660644editdlrm
format_stack.cpython-36.pyc8440644editdlrm
func_inspect.cpython-36.pyc87290644editdlrm
hashing.cpython-36.pyc62650644editdlrm
logger.cpython-36.pyc39600644editdlrm
memory.cpython-36.pyc288340644editdlrm
my_exceptions.cpython-36.pyc11300644editdlrm
numpy_pickle.cpython-36.pyc155640644editdlrm
numpy_pickle_compat.cpython-36.pyc70520644editdlrm
numpy_pickle_utils.cpython-36.pyc65160644editdlrm
parallel.cpython-36.pyc324160644editdlrm
pool.cpython-36.pyc124350644editdlrm
testing.cpython-36.pyc20370644editdlrm
_cloudpickle_wrapper.cpython-36.pyc5430644editdlrm
_dask.cpython-36.pyc105280644editdlrm
_deprecated_format_stack.cpython-36.pyc82160644editdlrm
_deprecated_my_exceptions.cpython-36.pyc27510644editdlrm
_memmapping_reducer.cpython-36.pyc161240644editdlrm
_multiprocessing_helpers.cpython-36.pyc12100644editdlrm
_parallel_backends.cpython-36.pyc196710644editdlrm
_store_backends.cpython-36.pyc139460644editdlrm
_utils.cpython-36.pyc11260644editdlrm
__init__.cpython-36.pyc45380644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/joblib/__pycache__/pool.cpython-36.pyc (12435B)
3 Eg7@sdZddlZddlZddlZddlmZyeWnek rLedZYnXddl m Z ddl m Z ddl m Z ddlmZdd lmZdd lmZmZdd lmZy ddlZWnek rdZYnXGd d d e ZGdddeZGdddeZGdddeZdS)aCustom implementation of multiprocessing.Pool with custom pickler. This module provides efficient ways of working with data stored in shared memory with numpy.memmap arrays without inducing any memory copy between the parent and child processes. This module should not be imported if multiprocessing is not available as it implements subclasses of multiprocessing Pool that uses a custom alternative to SimpleQueue. N)sleep)Pickler)HIGHEST_PROTOCOL)BytesIO)get_memmapping_reducers)TemporaryResourcesManager)mpassert_spawning)Poolc@s&eZdZdZdefddZddZdS)CustomizablePickleraPickler that accepts custom reducers. TODO python2_drop : can this be simplified ? HIGHEST_PROTOCOL is selected by default as this pickler is used to pickle ephemeral datastructures for interprocess communication hence no backward compatibility is required. `reducers` is expected to be a dictionary with key/values being `(type, callable)` pairs where `callable` is a function that give an instance of `type` will return a tuple `(constructor, tuple_of_objects)` to rebuild an instance out of the pickled `tuple_of_objects` as would return a `__reduce__` method. See the standard library documentation on pickling for more details. NcCsftj|||d|dkri}ttdr4tjj|_n tjj|_x |jD]\}}|j||qJWdS)N)protocoldispatch) r__init__hasattrrcopycopyregdispatch_tableitemsregister)selfwriterreducersr type reduce_funcr5/usr/local/lib/python3.6/site-packages/joblib/pool.pyrHs  zCustomizablePickler.__init__cs0ttdr"fdd}||j|<n |j|<dS)z@Attach a reducer function to a given type in the dispatch table.rcs|}|j|d|idS)Nobj) save_reduce)rrZreduced)rrr dispatcher\sz0CustomizablePickler.register..dispatcherN)rrrr)rrrrr)rrrWs   zCustomizablePickler.register)__name__ __module__ __qualname____doc__rrrrrrrr 0sr c@s:eZdZdZd ddZddZddZd d Zd d ZdS)CustomizablePicklingQueueaLocked Pipe implementation that uses a customizable pickler. This class is an alternative to the multiprocessing implementation of SimpleQueue in order to make it possible to pass custom pickling reducers, for instance to avoid memory copy when passing memory mapped datastructures. `reducers` is expected to be a dict with key / values being `(type, callable)` pairs where `callable` is a function that, given an instance of `type`, will return a tuple `(constructor, tuple_of_objects)` to rebuild an instance out of the pickled `tuple_of_objects` as would return a `__reduce__` method. See the standard library documentation on pickling for more details. NcCsL||_|jdd\|_|_|j|_tjdkr6d|_n |j|_|j dS)NF)duplexwin32) _reducersPipe_reader_writerLock_rlocksysplatform_wlock _make_methods)rcontextrrrrrus   z"CustomizablePicklingQueue.__init__cCs t||j|j|j|j|jfS)N)r r)r*r,r/r')rrrr __getstate__sz&CustomizablePicklingQueue.__getstate__cCs$|\|_|_|_|_|_|jdS)N)r)r*r,r/r'r0)rstaterrr __setstate__sz&CustomizablePicklingQueue.__setstate__cCs |jj S)N)r)poll)rrrremptyszCustomizablePicklingQueue.emptycsjj_jjjjfdd}|_jrPfdd_nj j _j dkrp_ n(j jj jfdd}|_ dS)Nc szSXdS)Nrr)racquirerecvrreleaserrgetsz4CustomizablePicklingQueue._make_methods..getcs,t}t|jj|jj|jdS)N)rr r'dumpr* send_bytesgetvalue)rbuffer)rrrsendsz5CustomizablePicklingQueue._make_methods..sendc sz|SXdS)Nr)r)r? wlock_acquire wlock_releaserrputsz4CustomizablePicklingQueue._make_methods..put) r)r8_recvr,acquirereleaser:r'_sendr*r?r/rB)rr:rBr)r7r8r9rr?r@rArr0s  z'CustomizablePicklingQueue._make_methods)N) r r!r"r#rr2r4r6r0rrrrr$ds  r$cs*eZdZdZdfdd ZddZZS) PicklingPoolaPool implementation with customizable pickling reducers. This is useful to control how data is shipped between processes and makes it possible to use shared memory without useless copies induces by the default pickling methods of the original objects passed as arguments to dispatch. `forward_reducers` and `backward_reducers` are expected to be dictionaries with key/values being `(type, callable)` pairs where `callable` is a function that, given an instance of `type`, will return a tuple `(constructor, tuple_of_objects)` to rebuild an instance out of the pickled `tuple_of_objects` as would return a `__reduce__` method. See the standard library documentation about pickling for more details. Nc sR|dkrt}|dkrt}||_||_t|d}|j|tt|jf|dS)N) processes)dict_forward_reducers_backward_reducersupdatesuperrGr)rrHforward_reducersbackward_reducerskwargspoolargs) __class__rrrs  zPicklingPool.__init__cCs@t|dt}t||j|_t||j|_|jj|_|jj |_ dS)NZ_ctx) getattrr r$rJZ_inqueuerKZ _outqueuerFZ _quick_putrCZ _quick_get)rr1rrr _setup_queuess    zPicklingPool._setup_queues)NNN)r r!r"r#rrT __classcell__rr)rRrrGs rGc s:eZdZdZd fdd Zfd d Zed d ZZS)MemmappingPoola:Process pool that shares large arrays to avoid memory copy. This drop-in replacement for `multiprocessing.pool.Pool` makes it possible to work efficiently with shared memory in a numpy context. Existing instances of numpy.memmap are preserved: the child suprocesses will have access to the same shared memory in the original mode except for the 'w+' mode that is automatically transformed as 'r+' to avoid zeroing the original data upon instantiation. Furthermore large arrays from the parent process are automatically dumped to a temporary folder on the filesystem such as child processes to access their content via memmapping (file system backed shared memory). Note: it is important to call the terminate method to collect the temporary folder used by the pool. Parameters ---------- processes: int, optional Number of worker processes running concurrently in the pool. initializer: callable, optional Callable executed on worker process creation. initargs: tuple, optional Arguments passed to the initializer callable. temp_folder: (str, callable) optional If str: Folder to be used by the pool for memmapping large arrays for sharing memory with worker processes. If None, this will try in order: - a folder pointed by the JOBLIB_TEMP_FOLDER environment variable, - /dev/shm if the folder exists and is writable: this is a RAMdisk filesystem available by default on modern Linux distributions, - the default system temporary folder that can be overridden with TMP, TMPDIR or TEMP environment variables, typically /tmp under Unix operating systems. if callable: An callable in charge of dynamically resolving a temporary folder for memmapping large arrays. max_nbytes int or None, optional, 1e6 by default Threshold on the size of arrays passed to the workers that triggers automated memory mapping in temp_folder. Use None to disable memmapping of large arrays. mmap_mode: {'r+', 'r', 'w+', 'c'} Memmapping mode for numpy arrays passed to workers. See 'max_nbytes' parameter documentation for more details. forward_reducers: dictionary, optional Reducers used to pickle objects passed from master to worker processes: see below. backward_reducers: dictionary, optional Reducers used to pickle return values from workers back to the master process. verbose: int, optional Make it possible to monitor how the communication of numpy arrays with the subprocess is handled (pickling or memmapping) prewarm: bool or str, optional, "auto" by default. If True, force a read on newly memmapped array to make sure that OS pre-cache it in memory. This can be useful to avoid concurrent disk access when the same data array is passed to different worker processes. If "auto" (by default), prewarm is set to True, unless the Linux shared memory partition /dev/shm is available and used as temp folder. `forward_reducers` and `backward_reducers` are expected to be dictionaries with key/values being `(type, callable)` pairs where `callable` is a function that give an instance of `type` will return a tuple `(constructor, tuple_of_objects)` to rebuild an instance out of the pickled `tuple_of_objects` as would return a `__reduce__` method. See the standard library documentation on pickling for more details. N.ArrFc sn|dk rtjdtt|} | |_t| j|||||d| d\}}t|||d} | j| t t |j f| dS)NzPcontext_id is deprecated and ignored in joblib 0.9.4 and will be removed in 0.11F)Ztemp_folder_resolver max_nbytes mmap_moderNrOverboseZunlink_on_gc_collectprewarm)rHrNrO) warningswarnDeprecationWarningr_temp_folder_managerrresolve_temp_folder_namerIrLrMrVr) rrHZ temp_folderrYrZrNrOr[Z context_idr\rPmanagerrQ)rRrrr&s" zMemmappingPool.__init__csd}xtt|D]h}ytt|jPWqtk rt}z2t|trdtd|d|krdtj d|WYdd}~XqXqW|j j dS)N g?rz@Failed to terminate worker processes in multiprocessing pool: %r) rangerMrV terminateOSError isinstance WindowsErrorrr]r^r`Z_unlink_temporary_resources)rZ n_retriesie)rRrrreEs  zMemmappingPool.terminatecCs,t|dddk r|jS|jj|_|jSdS)N_cached_temp_folder)rSrkr`ra)rrrr _temp_folderUs zMemmappingPool._temp_folder) NNrWrXNNrNF) r r!r"r#rrepropertyrlrUrr)rRrrVs K rV)r#rr-r]timerrh NameErrorrpicklerriorZ_memmapping_reducerrrZ_multiprocessing_helpersr r Zmultiprocessing.poolr Znumpynp ImportErrorr objectr$rGrVrrrr s.         4N'