• File: worker.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/__pycache__/worker.cpython-37.pyc
  • Date Modified: 05/11/2022 10:20 AM
  • File size: 6.8 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

kaK"@sdZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZyddlZejZWnek
rdZeZYnXdZGd
ddej Z!Gddde!Z"Gddde!Z#dS)z%Async gunicorn worker for aiohttp.webN)	FrameType)Any	AwaitableCallableOptionalUnion)AccessLogFormat)base)web)
set_result)Application)AccessLogger)GunicornWebWorkerGunicornUVLoopWebWorkerGunicornTokioWebWorkercseZdZejZejZe	e	ddfddZ
ddfddZdddd	Zddd
dZ
ddd
dZd edddddZddddZeeddddZeeddddZee	ddddZeedddZZS)!rN)argskwreturncs$tj||d|_d|_d|_dS)Nr)super__init___task	exit_code_notify_waiter)selfrr)	__class__A/opt/alt/python37/lib64/python3.7/site-packages/aiohttp/worker.pyr%szGunicornWebWorker.__init__)rcs0tt|_t|jtdS)N)asyncioget_event_loopcloseZnew_event_looploopZset_event_looprinit_process)r)rrrr",s
zGunicornWebWorker.init_processcCsr|j||_y|j|jWn tk
rD|jdYnX|j|j|j	t
|jdS)NzException in gunicorn worker)
r!Zcreate_task_runrZrun_until_complete	ExceptionlogZ	exceptionZshutdown_asyncgensr sysexitr)rrrrrun5s
zGunicornWebWorker.runcsd}t|jtr|j}nHt|jrP|IdH}t|tjrJ|}|j}q`|}ntd	|j|dkr|j
jrx|jj
nd}tj||j|j
j|||j
jd}|IdH|j
jr||j
nd}|}|dk	st|j}|dk	stx:|jD]0}tj||||j
jddd}|IdHqWt}	yx|jr||j}
|j
jrt|
|j
jkrtd|_|j d|nB|	tkr|j!t"krd|_|j d|n|#IdHq0WWnt$k
rYnX|%IdHdS)	NzUwsgi app should be either Application or async function returning Application, got {})ZloggerZkeepalive_timeout
access_logaccess_log_formatd_)Zssl_contextZshutdown_timeoutFzMax requests, shutting down: %sz!Parent changed, shutting down: %s)&
isinstancewsgir
rZiscoroutinefunctionr
Z	AppRunnerappRuntimeErrorformatcfgZ	accesslogr%r)Z	keepalive_get_valid_log_formatr*ZsetupZis_ssl_create_ssl_contextAssertionErrorserverZsocketsZSockSiteZgraceful_timeoutstartosgetpidaliveZnotifyZrequests_countZmax_requestsinfoZppidgetppid_wait_next_notify
BaseExceptionZcleanup)rZrunnerr/r.r)ctxr6ZsockZsitepidZcntrrrr#Asb

zGunicornWebWorker._runzasyncio.Future[bool]cCs>||j}|dk	st||_}|jd|j||S)Ng?)_notify_waiter_doner!r5Z
create_futurerZ
call_later)rr!waiterrrrr=sz#GunicornWebWorker._wait_next_notify)rBrcCs4|dkr|j}|dk	r t|d||jkr0d|_dS)NT)rr)rrBrrrrAs

z%GunicornWebWorker._notify_waiter_donecCs|jtj|jtjd|jtj|jtjd|jtj|jtjd|jtj|j	tjd|jtj
|jtj
d|jtj|j
tjdttjdttj
dtjdkrttjtjdS)NF))r!Zadd_signal_handlersignalSIGQUIThandle_quitSIGTERMZhandle_exitSIGINTSIGWINCHZhandle_winchSIGUSR1Zhandle_usr1SIGABRThandle_abortsiginterruptr&version_infoSIGCHLDSIG_DFL)rrrrinit_signalss 
zGunicornWebWorker.init_signals)sigframercCsd|_|j||dS)NF)r:r2Z
worker_intrA)rrSrTrrrrGszGunicornWebWorker.handle_quitcCs&d|_d|_|j|tddS)NFr)r:rr2Zworker_abortr&r')rrSrTrrrrMszGunicornWebWorker.handle_abort
SSLContext)r2rcCs\tdkrtdt|j}||j|j|j|_|j	rF|
|j	|jrX||j|S)z~Creates SSLContext instance for usage in asyncio.create_server.

        See ssl.SSLSocket.__init__ for more details.
        NzSSL is not supported.)
sslr0rUZssl_versionZload_cert_chainZcertfileZkeyfileZ	cert_reqsZverify_modeZca_certsZload_verify_locationsZciphersZset_ciphers)r2r?rrrr4sz%GunicornWebWorker._create_ssl_context)
source_formatrcCs.||jkr|jStd|r&tdn|SdS)Nz%\([^\)]+\)zGunicorn's style options in form of `%(name)s` are not supported for the log formatting. Please use aiohttp's format specification to configure access log formatting: http://docs.aiohttp.org/en/stable/logging.html#format-specification)DEFAULT_GUNICORN_LOG_FORMATDEFAULT_AIOHTTP_LOG_FORMATresearch
ValueError)rrWrrrr3s
z'GunicornWebWorker._get_valid_log_format)N)__name__
__module____qualname__rZ
LOG_FORMATrYGunicornAccessLogFormatdefaultrXrrr"r(r#r=rrArRintrrGrMstaticmethodr4strr3
__classcell__rr)rrr s	B	(	rcs"eZdZddfddZZS)rN)rcs0ddl}tt|tdS)Nr)uvlooprrr set_event_loop_policyEventLoopPolicyrr")rrf)rrrr"sz$GunicornUVLoopWebWorker.init_process)r]r^r_r"rerr)rrrsrcs"eZdZddfddZZS)rN)rcs0ddl}tt|tdS)Nr)tokiorrr rgrhrr")rri)rrrr"sz#GunicornTokioWebWorker.init_process)r]r^r_r"rerr)rrrsr)$__doc__rr8rZrEr&typesrtypingrrrrrZgunicorn.configrr`Zgunicorn.workersr	Zaiohttpr
ZhelpersrZweb_appr
Zweb_logrrVrUImportErrorobject__all__ZWorkerrrrrrrr<module>s0

Q