%PDF- %PDF-
Direktori : /usr/lib64/python3.6/concurrent/futures/__pycache__/ |
Current File : //usr/lib64/python3.6/concurrent/futures/__pycache__/process.cpython-36.pyc |
3 \P � @ sb d Z dZddlZddlZddlmZ ddlZddlmZ ddlZddlm Z ddl mZ ddlZddl Z ddlmZ ddlZddlZe j� Zd ad d� ZdZG d d� de�ZG dd� d�Zdd� ZG dd� de�ZG dd� de�ZG dd� de�Zdd� Zdd� Z dd� Z!dd � Z"d!d"� Z#d a$da%d#d$� Z&d%d&� Z'G d'd(� d(e(�Z)G d)d*� d*ej*�Z+ej,e� dS )+a* Implements ProcessPoolExecutor. The follow diagram and text describe the data-flow through the system: |======================= In-process =====================|== Out-of-process ==| +----------+ +----------+ +--------+ +-----------+ +---------+ | | => | Work Ids | => | | => | Call Q | => | | | | +----------+ | | +-----------+ | | | | | ... | | | | ... | | | | | | 6 | | | | 5, call() | | | | | | 7 | | | | ... | | | | Process | | ... | | Local | +-----------+ | Process | | Pool | +----------+ | Worker | | #1..n | | Executor | | Thread | | | | | +----------- + | | +-----------+ | | | | <=> | Work Items | <=> | | <= | Result Q | <= | | | | +------------+ | | +-----------+ | | | | | 6: call() | | | | ... | | | | | | future | | | | 4, result | | | | | | ... | | | | 3, except | | | +----------+ +------------+ +--------+ +-----------+ +---------+ Executor.submit() called: - creates a uniquely numbered _WorkItem and adds it to the "Work Items" dict - adds the id of the _WorkItem to the "Work Ids" queue Local worker thread: - reads work ids from the "Work Ids" queue and looks up the corresponding WorkItem from the "Work Items" dict: if the work item has been cancelled then it is simply removed from the dict, otherwise it is repackaged as a _CallItem and put in the "Call Q". New _CallItems are put in the "Call Q" until "Call Q" is full. NOTE: the size of the "Call Q" is kept small because calls placed in the "Call Q" can no longer be cancelled with Future.cancel(). - reads _ResultItems from "Result Q", updates the future stored in the "Work Items" dict and deletes the dict entry Process #1..n: - reads _CallItems from "Call Q", executes the calls, and puts the resulting _ResultItems in "Result Q" z"Brian Quinlan (brian@sweetapp.com)� N)�_base)�Full)�SimpleQueue)�wait)�partialFc C sJ da ttj� �} x| D ]\}}|jd � qW x| D ]\}}|j� q2W d S )NT)� _shutdown�list�_threads_queues�items�put�join)r �t�q� r �2/usr/lib64/python3.6/concurrent/futures/process.py�_python_exitO s r � c @ s e Zd Zdd� Zdd� ZdS )�_RemoteTracebackc C s || _ d S )N)�tb)�selfr r r r �__init__a s z_RemoteTraceback.__init__c C s | j S )N)r )r r r r �__str__c s z_RemoteTraceback.__str__N)�__name__� __module__�__qualname__r r r r r r r ` s r c @ s e Zd Zdd� Zdd� ZdS )�_ExceptionWithTracebackc C s0 t jt|�||�}dj|�}|| _d| | _d S )N� z """ %s""")� traceback�format_exception�typer �excr )r r r r r r r g s z _ExceptionWithTraceback.__init__c C s t | j| jffS )N)�_rebuild_excr r )r r r r � __reduce__l s z"_ExceptionWithTraceback.__reduce__N)r r r r r"