HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/thread-self/root/lib64/python2.7/site-packages/mercurial/worker.pyo
�
1�3\c@@skddlmZddlZddlZddlZddlZddlZddlZyddlZej	Wn!e
k
r�ddlmZnXddl
mZddlmZmZmZmZmZd�Zd�Zejs�ejrd	ZejZnd
ZeZed�Zed�Zd
�Zd�Z d�Z!ejrRe!Z"neZ"e Z#d�Z$dS(i(tabsolute_importNi(t
selectors2(t_(tencodingterrortpycompattscmutiltutilcC@s�y)ttjd��}|dkr(|SWnttfk
rBnXy'ttjd�}|dkri|SWnttfk
r�nXdS(s-try to count the number of CPUs on the systemtSC_NPROCESSORS_ONLNitNUMBER_OF_PROCESSORSi(tinttostsysconftAttributeErrort
ValueErrorRtenvirontKeyError(tn((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt	countcpus scC@s}|jdd�}|rdy t|�}|dkr7|SWqdtk
r`tjtd���qdXnttt�d�d�S(Ntworkertnumcpusis!number of cpus must be an integerii (	tconfigR
RRtAbortRtmintmaxR(tuitsR((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt_numworkers5s
g{�G�z�?gꌠ9Y>)FcC@sG|rtrtS||}t|�}|t|||}|dkS(setry to determine whether the benefit of multiple processes can
    outweigh the cost of starting themg333333�?(t_DISALLOW_THREAD_UNSAFEtFalseRt
_STARTUP_COST(Rt	costperoptnopst
threadsafetlineartworkerstbenefit((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt
worthwhileJs

cC@sZ|jdd�}|rIt||t|�d|�rIt||||�S|||f�S(s�run a function, possibly in parallel in multiple worker
    processes.

    returns a progress iterator

    costperarg - cost of a single task

    func - function to run

    staticargs - arguments to pass to every invocation of the function

    args - arguments to split into chunks, to pass to individual
    workers

    threadsafe - whether work items are thread safe and can be executed using
    a thread-based worker. Should be disabled for CPU heavy tasks that don't
    release the GIL.
    RtenabledR!(t
configboolR%tlent_platformworker(Rt
costperargtfunct
staticargstargsR!R&((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyRVs$c
#@s�t|�}tjtj��tjtjtj�t�dg����fd��t��fd�����fd�}tjtj|��|j�t	j
�}g�xdt||�D]S�t	j�\���j
��f�d}z�yut	j�}|dkrltjtj��tjtj�������
�fd�}	tj||	�}nWnOt	j
�|kr��ntj�d}
t|
t�}|jd|�nXWdt	j
�|kr	zy|j�WnnXWdt	j|d@�XnX�j|�q�Wtj��	xC�D];\��t	j���	jt	j�d	d�tj�q.W����	�fd
�}y�t��}
x�|
dkrFx��	j�D]�\}}yt j!j"|j#�VWq�t$k
r�	j%|j#�|j#j�|
d8}
q�t&k
r>}|j't'j(kr8q�n�q�Xq�Wq�WWn��|��nX|�}|r�|dkr�t	j)t	j
�|�ntj*|�ndS(Nic@smtjtj��xS�D]K}ytj|tj�Wqtk
rd}|jtjkre�qeqXqWdS(N(tsignaltSIGCHLDRtkilltSIGTERMtOSErrorterrnotESRCH(tpterr(toldchldhandlertpids(s6/usr/lib64/python2.7/site-packages/mercurial/worker.pytkillworkersss
c@s�x��j�D]�}d}}x�tr�y,tj||r>dntj�\}}PWq tk
r�}|jtjkr|q q�|jtjkr��j	|�Pq��q Xq W|s�q
n�j	|�t
|�}|r
�dr
|�d<q
q
WdS(Ni(tcopytTrueRtwaitpidtWNOHANGR2R3tEINTRtECHILDtdiscardt_exitstatus(tblockingtpidR5tstte(R8tproblem(s6/usr/lib64/python2.7/site-packages/mercurial/worker.pytwaitforworkerss&
	'

c@s%�dt��dr!��ndS(NRBi(R(tsignumtframe(R9RFRG(s6/usr/lib64/python2.7/site-packages/mercurial/worker.pytsigchldhandler�s

i����c@s�x2�d D]&\}}tj|�tj|�qWtj��x7���f�D]"}tj�tjj|��qVWdS(Ni����i(RtclosetwriteRtpickletdumps(trtwtresult(R+tpargstpipestrfdR,twfd(s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt
workerfunc�s

 tforcei�trbc@s?tjtj����tjtj���j��dS(Ni(R.tSIGINTR/RK((R7t
oldhandlerRFtselectorRG(s6/usr/lib64/python2.7/site-packages/mercurial/worker.pytcleanup�s

i(+RR.t	getsignalRYtSIG_IGNtsetR;R/tflushRtgetpidt	partitiontpipetappendtforkRt	callcatchtsystexc_infot
issubclasstKeyboardInterruptt	tracebackt_exittaddt	selectorstDefaultSelectorRKtregistertfdopent
EVENT_READR(tselectRRMtloadtfileobjtEOFErrort
unregistertIOErrorR3R>R0texit(RR+R,R-R#RJt	parentpidtretRCRVtexctypeRWR\t	openpipestkeyteventsREtstatus((
R+R9R7RZRRR8RSRFRTR[R,RGRUs6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt_posixworkerns�
	
&


	cC@s=tj|�rtj|�Stj|�r9tj|�SdS(s�convert a posix exit status into the same form returned by
    os.spawnv

    returns None if the process was stopped instead of exitingN(Rt	WIFEXITEDtWEXITSTATUStWIFSIGNALEDtWTERMSIG(tcode((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt_posixexitstatus�s
c#@s�dtjfd��Y}g���fd�}t��}tjj�}tjj�}x(t||d�D]}	|j|	�qoWx@t|�D]2}
|||||�}�j	|�|j
�q�Wy�x�t��dkrqx|j�s�|j
�Vq�W�djd�g�D]}|j�s|^q}
x6|
D].}|jdk	r]|j�n�j|�q<Wq�WWn!ttfk
r�|��nXx|j�s�|j
�Vq�WdS(NtWorkercB@s/eZddddd�Zd�Zd�ZRS(c		
S@sktjj|d|d|d|d|�||_||_||_||_t|_t	|_
d|_dS(Ntgroupttargettnametverbose(
t	threadingtThreadt__init__t
_taskqueuet_resultqueuet_funct_staticargsRt_interruptedR;tdaemontNonet	exception(	tselft	taskqueuetresultqueueR+R,R�R�R�R�((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyR��s
						cS@s
t|_dS(N(R;R�(R�((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt	interrupt	scS@s�y�x�|jj�s�yT|jj�}x>|j|j|f�D]#}|jj|�|jrAdSqAWWqtj	j
k
r�PqXqWWntk
r�}||_�nXdS(N(
R�temptyt
get_nowaitR�R�R�tputR�RtqueuetEmptyt	ExceptionR�(R�R-tresRE((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pytruns 	
	N(t__name__t
__module__R�R�R�R�(((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyR��s	c@s�tj�d}x�D]}|j�qWxN�D]F}|tj�}|j|�|j�r2�jtd��dSq2WdS(Nis:failed to kill worker threads while handling an exception
(ttimeR�tjointis_alivetwarnR(t
cleanupendttt
remainingtime(tthreadsR(s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyttrykillworkers!s


iig�������?(R�R�RRR�tQueueRbR�trangeRdtstartR(R�tgetR�R�R�R�tremoveR�Rj(RR+R,R-R�R�R#R�R�RRt_iR�t_ttfinishedthreads((R�Rs6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt_windowsworker�s6$
%
cc@s-x&t|�D]}||d|�Vq
WdS(s�partition a list into N slices of roughly equal size

    The current strategy takes every Nth element from the input. If
    we ever write workers that need to preserve grouping in input
    we should consider allowing callers to specify a partition strategy.

    mpm is not a fan of this partitioning strategy when files are involved.
    In his words:

        Single-threaded Mercurial makes a point of creating and visiting
        files in a fixed order (alphabetical). When creating files in order,
        a typical filesystem is likely to allocate them on nearby regions on
        disk. Thus, when revisiting in the same order, locality is maximized
        and various forms of OS and disk-level caching and read-ahead get a
        chance to work.

        This effect can be quite significant on spinning disks. I discovered it
        circa Mercurial v0.4 when revlogs were named by hashes of filenames.
        Tarring a repo and copying it to another disk effectively randomized
        the revlog ordering on disk by sorting the revlogs by hash and suddenly
        performance of my kernel checkout benchmark dropped by ~10x because the
        "working set" of sectors visited no longer fit in the drive's cache and
        the workload switched from streaming to random I/O.

        What we should really be doing is have workers read filenames from a
        ordered queue. This preserves locality and also keeps any worker from
        getting more than one file out of balance.
    N(R�(tlsttnslicesti((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyRbSs(%t
__future__RR3RR.RgR�R�RntBaseSelectortImportErrort
thirdpartyRti18nRtRRRRRRRtisposixt	iswindowsRRRR;R%RR�R�R�R)RARb(((s6/usr/lib64/python2.7/site-packages/mercurial/worker.pyt<module>s<
(			�	
	R