Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
supervisor / __pycache__ / rpcinterface.cpython-38.pyc
Size: Mime:
U

VƧ\Ցã@srddlZddlZddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZmZmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#m$Z$dZ%Gdd„dƒZ&dd„Z'dd„Z(dd„Z)d d!„Z*d"d#„Z+dS)$éN)Ú	as_string)Úas_bytes)Úunicode)Ú	AutomaticÚ
signal_number)ÚreadFile)ÚtailFile)Ú
NotExecutable)ÚNotFound)ÚNoPermission)Ú
make_namespec)Úsplit_namespec)ÚVERSION)Únotify)ÚRemoteCommunicationEvent)ÚNOT_DONE_YET)Ú
capped_intÚFaultsÚRPCError)ÚSupervisorStates)ÚgetSupervisorStateDescription)Ú
ProcessStates)ÚgetProcessStateDescription)ÚRUNNING_STATESÚSTOPPED_STATESz3.0c@sneZdZdd„Zdd„Zdd„ZeZdd„Zd	d
„Zdd„Z	d
d„Z
dd„ZeZdd„Z
dd„Zdd„Zdd„Zdd„Zdd„ZdTdd„Zd d!„ZdUd#d$„ZdVd%d&„ZdWd'd(„ZdXd)d*„ZdYd+d,„ZdZd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Z d;d<„Z!d=d>„Z"d?d@„Z#dAdB„Z$e$Z%dCdD„Z&dEdF„Z'dGdH„Z(e(Z)dIdJ„Z*dKdL„Z+e+Z,dMdN„Z-dOdP„Z.dQdR„Z/dSS)[ÚSupervisorNamespaceRPCInterfacecCs
||_dS©N©Úsupervisord)Úselfr©r ú&./build/lib/supervisor/rpcinterface.pyÚ__init__/sz(SupervisorNamespaceRPCInterface.__init__cCs4||_t|jjjtƒr0|jjjtjkr0tt	j
ƒ‚dSr)Zupdate_textÚ
isinstancerÚoptionsÚmoodÚintrÚRUNNINGrrZSHUTDOWN_STATE)rÚtextr r r!Ú_update2s
ÿz'SupervisorNamespaceRPCInterface._updatecCs| d¡tS)zj Return the version of the RPC API used by supervisord

        @return string version version id
        Ú
getAPIVersion)r)ÚAPI_VERSION©rr r r!r*:s
z-SupervisorNamespaceRPCInterface.getAPIVersioncCs| d¡tS)zw Return the version of the supervisor package in use by supervisord

        @return string version version id
        ÚgetSupervisorVersion)r)rr,r r r!r-Ds
z4SupervisorNamespaceRPCInterface.getSupervisorVersioncCs| d¡|jjjS)zh Return identifying string of supervisord

        @return string identifier identifying string
        ÚgetIdentification)r)rr$Z
identifierr,r r r!r.Ls
z1SupervisorNamespaceRPCInterface.getIdentificationcCs*| d¡|jjj}t|ƒ}||dœ}|S)z„ Return current state of supervisord as a struct

        @return struct A struct with keys int statecode, string statename
        ÚgetState)Z	statecodeÚ	statename)r)rr$r%r)rÚstater0Údatar r r!r/Ts

þz(SupervisorNamespaceRPCInterface.getStatecCs| d¡|jj ¡S)z@ Return the PID of supervisord

        @return int PID
        ÚgetPID)r)rr$Zget_pidr,r r r!r3cs
z&SupervisorNamespaceRPCInterface.getPIDc
CsŽ| d¡|jjj}|dks(tj |¡s4ttj	|ƒ‚zt
t|t|ƒt|ƒƒƒWSt
k
rˆ}z|jd}ttt|ƒƒ‚W5d}~XYnXdS)zø Read length bytes from the main log starting at offset

        @param int offset         offset to start reading from.
        @param int length         number of bytes to read from the log.
        @return string result     Bytes of log
        ÚreadLogNr)r)rr$ÚlogfileÚosÚpathÚexistsrrÚNO_FILErrr&Ú
ValueErrorÚargsÚgetattr)rÚoffsetÚlengthr5ÚinstÚwhyr r r!r4ks


z'SupervisorNamespaceRPCInterface.readLogc	Cs¢| d¡|jjj}|dks*|jj |¡s4ttjƒ‚z|jj |¡Wn"t	t
fk
rhttjƒ‚YnX|jjjj
D]&}t|dƒrv|jjj d¡| ¡qvdS)z^ Clear the main log.

        @return boolean result always returns True unless error
        ÚclearLogNÚreopenzreopening log fileT)r)rr$r5r8rrr9ÚremoveÚOSErrorÚIOErrorÚFAILEDZloggerZhandlersÚhasattrÚinforB)rr5Zhandlerr r r!rAs




z(SupervisorNamespaceRPCInterface.clearLogcCs| d¡tj|jj_dS)zk Shut down the supervisor process

        @return boolean result always returns True unless error
        ÚshutdownT)r)rZSHUTDOWNrr$r%r,r r r!rI˜s
z(SupervisorNamespaceRPCInterface.shutdowncCs| d¡tj|jj_dS)zi Restart the supervisor process

        @return boolean result  always return True unless error
        ÚrestartT)r)rZ
RESTARTINGrr$r%r,r r r!rJ¡s
z'SupervisorNamespaceRPCInterface.restartc
Cs”| d¡z|jjjddWn.tk
rL}zttj|ƒ‚W5d}~XYnX|j ¡\}}}dd„|Dƒ}dd„|Dƒ}dd„|Dƒ}|||ggS)	a°
        Reload the configuration.

        The result contains three arrays containing names of process
        groups:

        * `added` gives the process groups that have been added
        * `changed` gives the process groups whose contents have
          changed
        * `removed` gives the process groups that are no longer
          in the configuration

        @return array result  [[added, changed, removed]]

        ÚreloadConfigF)Zdo_usageNcSsg|]
}|j‘qSr ©Úname©Ú.0Úgroupr r r!Ú
<listcomp>Ãsz@SupervisorNamespaceRPCInterface.reloadConfig.<locals>.<listcomp>cSsg|]
}|j‘qSr rLrNr r r!rQÄscSsg|]
}|j‘qSr rLrNr r r!rQÅs)	r)rr$Zprocess_configr:rrZCANT_REREADZdiff_to_active)rÚmsgZaddedZchangedZremovedr r r!rK«s
z,SupervisorNamespaceRPCInterface.reloadConfigcCsV| d¡|jjjD]0}|j|kr|j |¡}|s>ttj|ƒ‚dSqttj	|ƒ‚dS)zº Update the config for a running process from config file.

        @param string name         name of process group to add
        @return boolean result     true if successful
        ÚaddProcessGroupTN)
r)rr$Úprocess_group_configsrMZadd_process_grouprrZ
ALREADY_ADDEDÚBAD_NAME)rrMÚconfigÚresultr r r!rSÈs

z/SupervisorNamespaceRPCInterface.addProcessGroupcCsB| d¡||jjkr"ttj|ƒ‚|j |¡}|s>ttj|ƒ‚dS)zÕ Remove a stopped process from the active configuration.

        @param string name         name of process group to remove
        @return boolean result     Indicates whether the removal was successful
        ÚremoveProcessGroupT)r)rÚprocess_groupsrrrUZremove_process_groupZ
STILL_RUNNING)rrMrWr r r!rXØs
z2SupervisorNamespaceRPCInterface.removeProcessGroupFcCsÄg}|rpt|jj ¡ƒ}| ¡|D]H}|jj|}t|j ¡ƒ}| ¡|D]}|j|}| ||f¡qNq$nPt|jj ¡ƒ}	|	 ¡|	D]2}t|j ¡ƒ}
|
 ¡|
D]}| ||f¡qªqŒ|Sr)ÚlistrrYÚkeysÚsortÚ	processesÚappendÚvalues)rÚlexicalÚ
all_processesZgroup_namesÚ
group_namerPZ
process_namesÚprocess_nameÚprocessÚgroupsr]r r r!Ú_getAllProcessesçs&
z0SupervisorNamespaceRPCInterface._getAllProcessescCsft|ƒ\}}|jj |¡}|dkr.ttj|ƒ‚|dkr>|dfS|j |¡}|dkr^ttj|ƒ‚||fSr)r
rrYÚgetrrrUr])rrMrbrcrPrdr r r!Ú_getGroupAndProcesssz3SupervisorNamespaceRPCInterface._getGroupAndProcessTc

s0| d¡| ˆ¡\}‰ˆdkr8tˆƒ\}}| ||¡Szˆ ¡\}}Wnjtk
r|}zttj|j	dƒ‚W5d}~XYn8t
tfk
r²}zttj|j	dƒ‚W5d}~XYnXˆ 
¡tkrÌttjˆƒ‚ˆ ¡|j ¡ˆjrðttjˆƒ‚ˆ ¡|r,ˆ 
¡tjkr,‡‡fdd„}	d|	_||	_|	SdS)zä Start a process

        @param string name Process name (or ``group:name``, or ``group:*``)
        @param boolean wait Wait for process to be fully started
        @return boolean result     Always true unless error

        ÚstartProcessNrcsHˆjrttjˆƒ‚ˆ ¡}|tjtjfkr6ttjˆƒ‚|tjkrDdSt	S©NT)
ÚspawnerrrrÚSPAWN_ERRORÚ	get_staterZSTARTINGr'ZABNORMAL_TERMINATIONr)r1©rMrdr r!ÚonwaitIs
z<SupervisorNamespaceRPCInterface.startProcess.<locals>.onwait皙™™™™©?T)r)rhr
ÚstartProcessGroupZget_execv_argsr
rrr9r;r	rZNOT_EXECUTABLErmrZALREADY_STARTEDZspawnrÚreaprkrlZ
transitionrr'ÚdelayÚrpcinterface)
rrMÚwaitrPrbrcÚfilenameÚargvr@ror rnr!ris0
"$

z,SupervisorNamespaceRPCInterface.startProcesscsv| d¡|jj |¡‰ˆdkr,ttj|ƒ‚tˆj 	¡ƒ}| 
¡‡fdd„|Dƒ}t|t|j
|d}d|_||_|S)zö Start all processes in the group named 'name'

        @param string name     The group name
        @param boolean wait    Wait for each process to be fully started
        @return array result   An array of process status info structs
        rqNcsg|]}ˆ|f‘qSr r ©rOrd©rPr r!rQmszESupervisorNamespaceRPCInterface.startProcessGroup.<locals>.<listcomp>©rurp)r)rrYrgrrrUrZr]r_r\Úmake_allfuncÚisNotRunningrirsrt)rrMrur]Ústartallr ryr!rq]s

ÿz1SupervisorNamespaceRPCInterface.startProcessGroupcCs4| d¡| ¡}t|t|j|d}d|_||_|S)zÏ Start all processes listed in the configuration file

        @param boolean wait    Wait for each process to be fully started
        @return array result   An array of process status info structs
        ÚstartAllProcessesrzrp)r)rfr{r|rirsrt)rrur]r}r r r!r~vs

ÿz1SupervisorNamespaceRPCInterface.startAllProcessescs¦| d¡| |¡\}‰ˆdkr8t|ƒ\}}| ||¡Sˆ ¡tkrPttj|ƒ‚ˆ 	¡}|dk	rlttj
|ƒ‚|j ¡|r¢ˆ ¡t
kr¢‡fdd„}d|_||_|SdS)a Stop a process named by name

        @param string name  The name of the process to stop (or 'group:name')
        @param boolean wait        Wait for the process to be fully stopped
        @return boolean result     Always return True unless error
        ÚstopProcessNcsˆ ¡ˆ ¡tkrtSdSrj)Zstop_reportrmrrr ©rdr r!roªsz;SupervisorNamespaceRPCInterface.stopProcess.<locals>.onwaitrT)r)rhr
ÚstopProcessGrouprmrrrÚNOT_RUNNINGÚstoprFrrrrrsrt)rrMrurPrbrcrRror r€r!r†s"

	z+SupervisorNamespaceRPCInterface.stopProcesscsv| d¡|jj |¡‰ˆdkr,ttj|ƒ‚tˆj 	¡ƒ}| 
¡‡fdd„|Dƒ}t|t|j
|d}d|_||_|S)zý Stop all processes in the process group named 'name'

        @param string name     The group name
        @param boolean wait    Wait for each process to be fully stopped
        @return array result   An array of process status info structs
        rNcsg|]}ˆ|f‘qSr r rxryr r!rQÉszDSupervisorNamespaceRPCInterface.stopProcessGroup.<locals>.<listcomp>rzrp)r)rrYrgrrrUrZr]r_r\r{Ú	isRunningrrsrt)rrMrur]Úkillallr ryr!r¹s

ÿz0SupervisorNamespaceRPCInterface.stopProcessGroupcCs4| d¡| ¡}t|t|j|d}d|_||_|S)zÁ Stop all processes in the process list

        @param  boolean wait   Wait for each process to be fully stopped
        @return array result   An array of process status info structs
        ÚstopAllProcessesrzrp)r)rfr{r„rrsrt)rrur]r…r r r!r†Òs

ÿz0SupervisorNamespaceRPCInterface.stopAllProcessesc	Cs¢| d¡| |¡\}}|dkr:t|ƒ\}}|j||dSzt|ƒ}Wn tk
rfttj|ƒ‚YnX| 	¡t
kr€ttj|ƒ‚| |¡}|dk	ržttj
|ƒ‚dS)zù Send an arbitrary UNIX signal to the process named by name

        @param string name    Name of the process to signal (or 'group:name')
        @param string signal  Signal to send, as name ('HUP') or number ('1')
        @return boolean
        Ú
signalProcessN©ÚsignalT)r)rhr
ÚsignalProcessGrouprr:rrZ
BAD_SIGNALrmrr‚r‰rF)	rrMr‰rPrdrbrcZsigrRr r r!r‡ãs

z-SupervisorNamespaceRPCInterface.signalProcesscsz|jj |¡‰| d¡ˆdkr,ttj|ƒ‚tˆj 	¡ƒ}| 
¡‡fdd„|Dƒ}t|t|j
|d}|ƒ}| d¡|S)zÔ Send a signal to all processes in the group named 'name'

        @param string name    The group name
        @param string signal  Signal to send, as name ('HUP') or number ('1')
        @return array
        rŠNcsg|]}ˆ|f‘qSr r rxryr r!rQszFSupervisorNamespaceRPCInterface.signalProcessGroup.<locals>.<listcomp>rˆ)rrYrgr)rrrUrZr]r_r\r{r„r‡)rrMr‰r]ZsendallrWr ryr!rŠs

ÿ
z2SupervisorNamespaceRPCInterface.signalProcessGroupcCs.| ¡}t|t|j|d}|ƒ}| d¡|S)zÑ Send a signal to all processes in the process list

        @param string signal  Signal to send, as name ('HUP') or number ('1')
        @return array         An array of process status info structs
        rˆÚsignalAllProcesses)rfr{r„r‡r))rr‰r]Z	signalallrWr r r!r‹s
ÿ
z2SupervisorNamespaceRPCInterface.signalAllProcessescCsö| d¡g}|jjjD]È}|j|jjk}|jD]®}|j|j|j	|j|j
||j|j|j
|j|j
|j|j|j|j|j|j|jt|jƒ|j|j|j|j|j|j|jdœ}| dd„| ¡Dƒ¡| dd„| ¡Dƒ¡|  |¡q0q|j!dd„d|S)	zÒ Get info about all available process configurations. Each struct
        represents a single process (i.e. groups get flattened).

        @return array result  An array of process config info structs
        ÚgetAllConfigInfo)Ú	autostartÚcommandÚ	exitcodesrPZ
group_prioÚinuseÚkillasgrouprMZprocess_prioÚredirect_stderrÚstartretriesÚ	startsecsÚstdout_capture_maxbytesÚstdout_events_enabledÚstdout_logfileÚstdout_logfile_backupsÚstdout_logfile_maxbytesÚ
stdout_syslogÚ
stopsignalÚstopwaitsecsÚstderr_capture_maxbytesÚstderr_events_enabledÚstderr_logfileÚstderr_logfile_backupsÚstderr_logfile_maxbytesÚ
stderr_syslogcss"|]\}}|tkr|dfVqdS)ÚautoN)r©rOÚkÚvr r r!Ú	<genexpr>PszCSupervisorNamespaceRPCInterface.getAllConfigInfo.<locals>.<genexpr>css"|]\}}|dkr|dfVqdS)NZnoner r¤r r r!r§QscSs|dS)NrMr )Úrr r r!Ú<lambda>TózBSupervisorNamespaceRPCInterface.getAllConfigInfo.<locals>.<lambda>)Úkey)"r)rr$rTrMrYZprocess_configsrrŽrZpriorityr‘r’r“r”r•r–r—r˜r™ršr&r›rœrržrŸr r¡r¢ÚupdateÚitemsr^r\)rZ
configinfoZgconfigrZpconfigÚdr r r!rŒ(sJ

çz0SupervisorNamespaceRPCInterface.getAllConfigInfocCsþ|d}|tjkr‚|d}|d}tjt |¡dd…Ž}tjt |¡dd…Ž}||}t|ƒdkrpt d¡}d|d|f}nx|tjtjfkr¬|d}|súd	|d
}nN|tj	tj
fkrö|drð|d}	tjt |	¡dd…Ž}
|
 d
¡}qúd}nd}|S)Nr1ÚstartÚnowérzpid %s, uptime %sÚpidrkzunknown error (try "tail %s")rMrƒéz%b %d %I:%M %pzNot startedÚ)
rr'ÚdatetimeÚtimeÚgmtimeÚ_total_secondsÚ	timedeltaZFATALZBACKOFFZSTOPPEDZEXITEDÚ	localtimeÚstrftime)rrHr1r¯r°Zstart_dtZnow_dtZuptimeZdescrƒZstop_dtr r r!Ú_interpretProcessInfoWs,

z5SupervisorNamespaceRPCInterface._interpretProcessInfocCsÄ| d¡| |¡\}}|dkr,ttj|ƒ‚t|jƒ}t|jƒ}t| ¡ƒ}| 	¡}|j
p\d}|jpfd}	|jj
prd}
|jjp~d}|jj|jj||||t|ƒ||	|
|
||jdœ
}| |¡}
|
|d<|S)zà Get info about a process named name

        @param string name The name of the process (or 'group:name')
        @return struct result     A structure containing data about the process
        ÚgetProcessInfoNr´r)
rMrPr¯rƒr°r1r0rkÚ
exitstatusr5r—rŸr²Údescription)r)rhrrrUrZ	laststartZlaststopÚ_nowrmrkr¾rVr—rŸrMrr²r¼)rrMrPrdr¯rƒr°r1rkr¾r—rŸrHr¿r r r!r½vs:




ó
z.SupervisorNamespaceRPCInterface.getProcessInfocCst ¡Sr)r¶r,r r r!rÀ¤sz$SupervisorNamespaceRPCInterface._nowcCsN| d¡|jdd}g}|D]*\}}t|jj|jjƒ}| | |¡¡q|S)zh Get info about all processes

        @return array result  An array of process status results
        ÚgetAllProcessInfoT)r`)r)rfrrVrMr^r½)rraÚoutputrPrdrMr r r!rÁ¨s
z1SupervisorNamespaceRPCInterface.getAllProcessInfoc

Cs¬| |¡\}}|dkr"ttj|ƒ‚t|jd|ƒ}|dksFtj |¡sRttj	|ƒ‚zt
t|t|ƒt|ƒƒƒWSt
k
r¦}z|jd}	ttt|	ƒƒ‚W5d}~XYnXdS)Nú
%s_logfiler)rhrrrUr<rVr6r7r8r9rrr&r:r;)
rrMr=r>ÚchannelrPrdr5r?r@r r r!Ú_readProcessLog·s
z/SupervisorNamespaceRPCInterface._readProcessLogcCs| d¡| |||d¡S)aI Read length bytes from name's stdout log starting at offset

        @param string name        the name of the process (or 'group:name')
        @param int offset         offset to start reading from.
        @param int length         number of bytes to read from the log.
        @return string result     Bytes of log
        ÚreadProcessStdoutLogÚstdout©r)rÅ©rrMr=r>r r r!rÆÈs
z4SupervisorNamespaceRPCInterface.readProcessStdoutLogcCs| d¡| |||d¡S)aI Read length bytes from name's stderr log starting at offset

        @param string name        the name of the process (or 'group:name')
        @param int offset         offset to start reading from.
        @param int length         number of bytes to read from the log.
        @return string result     Bytes of log
        ÚreadProcessStderrLogÚstderrrÈrÉr r r!rÊÕs
z4SupervisorNamespaceRPCInterface.readProcessStderrLogcCsd| |¡\}}|dkr"ttj|ƒ‚t|jd|ƒ}|dksFtj |¡sPdddgSt	|t
|ƒt
|ƒƒS)NrÃr´rF)rhrrrUr<rVr6r7r8rr&)rrMr=r>rÄrPrdr5r r r!Ú_tailProcessLogàs
z/SupervisorNamespaceRPCInterface._tailProcessLogcCs| d¡| |||d¡S)a¯
        Provides a more efficient way to tail the (stdout) log than
        readProcessStdoutLog().  Use readProcessStdoutLog() to read
        chunks and tailProcessStdoutLog() to tail.

        Requests (length) bytes from the (name)'s log, starting at
        (offset).  If the total log size is greater than (offset +
        length), the overflow flag is set and the (offset) is
        automatically increased to position the buffer at the end of
        the log.  If less than (length) bytes are available, the
        maximum number of available bytes will be returned.  (offset)
        returned is always the last offset in the log +1.

        @param string name         the name of the process (or 'group:name')
        @param int offset          offset to start reading from
        @param int length          maximum number of bytes to return
        @return array result       [string bytes, int offset, bool overflow]
        ÚtailProcessStdoutLogrÇ©r)rÌrÉr r r!rÍís
z4SupervisorNamespaceRPCInterface.tailProcessStdoutLogcCs| d¡| |||d¡S)a¯
        Provides a more efficient way to tail the (stderr) log than
        readProcessStderrLog().  Use readProcessStderrLog() to read
        chunks and tailProcessStderrLog() to tail.

        Requests (length) bytes from the (name)'s log, starting at
        (offset).  If the total log size is greater than (offset +
        length), the overflow flag is set and the (offset) is
        automatically increased to position the buffer at the end of
        the log.  If less than (length) bytes are available, the
        maximum number of available bytes will be returned.  (offset)
        returned is always the last offset in the log +1.

        @param string name         the name of the process (or 'group:name')
        @param int offset          offset to start reading from
        @param int length          maximum number of bytes to return
        @return array result       [string bytes, int offset, bool overflow]
        ÚtailProcessStderrLogrËrÎrÉr r r!rÏs
z4SupervisorNamespaceRPCInterface.tailProcessStderrLogc	Csb| d¡| |¡\}}|dkr,ttj|ƒ‚z| ¡Wn$ttfk
r\ttj|ƒ‚YnXdS)zÞ Clear the stdout and stderr logs for the named process and
        reopen them.

        @param string name   The name of the process (or 'group:name')
        @return boolean result      Always True unless error
        ÚclearProcessLogsNT)	r)rhrrrUZ
removelogsrErDrF)rrMrPrdr r r!rÐs
z0SupervisorNamespaceRPCInterface.clearProcessLogscsX| d¡g‰g‰| ¡}|D]\}}ˆ |||jf¡q‡‡fdd„}d|_||_|S)zm Clear all process log files

        @return array result   An array of process status info structs
        ÚclearAllProcessLogsc
s¤ˆsˆSˆ d¡\}}}t|jj|jjƒ}z||ƒWnBtk
rx}z$ˆ |jj|jj|j|jdœ¡W5d}~XYn Xˆ |jj|jjtj	ddœ¡ˆr t
SˆS)Nr©rMrPZstatusr¿ÚOK)ÚpoprrVrMrr^Úcoder(rÚSUCCESSr)rPrdÚcallbackrMÚe©Ú	callbacksÚresultsr r!ÚclearallAs0ýÿýÿzESupervisorNamespaceRPCInterface.clearAllProcessLogs.<locals>.clearallrp)r)rfr^ÚclearProcessLogrsrt)rrarPrdrÜr rÙr!rÑ3s
z3SupervisorNamespaceRPCInterface.clearAllProcessLogsc
Cs¾| d¡t|tttfƒs&ttj|ƒ‚t|ƒ}| 	|¡\}}|dkrPttj
|ƒ‚|jr\|jrhttj
|ƒ‚z| |¡WnBtk
r¸}z$|jdtjkr¦ttj|ƒ‚n‚W5d}~XYnXdS)a— Send a string of chars to the stdin of the process name.
        If non-7-bit data is sent (unicode), it is encoded to utf-8
        before being sent to the process' stdin.  If chars is not a
        string or is not unicode, raise INCORRECT_PARAMETERS.  If the
        process is not running, raise NOT_RUNNING.  If the process'
        stdin cannot accept input (e.g. it was closed by the child
        process), raise NO_FILE.

        @param string name        The process name to send to (or 'group:name')
        @param string chars       The character data to send to the process
        @return boolean result    Always return True unless error
        ÚsendProcessStdinNrT)r)r#ÚstrÚbytesrrrZINCORRECT_PARAMETERSrrhrUr²Zkillingr‚ÚwriterDr;ÚerrnoZEPIPEr9)rrMÚcharsrPrdr@r r r!rÞ`s 
z0SupervisorNamespaceRPCInterface.sendProcessStdincCs:t|tƒr| d¡}t|tƒr(| d¡}tt||ƒƒdS)aB Send an event that will be received by event listener
        subprocesses subscribing to the RemoteCommunicationEvent.

        @param  string  type  String for the "type" key in the event header
        @param  string  data  Data for the event body
        @return boolean       Always return True unless error
        zutf-8T)r#rÚencoderr)rÚtyper2r r r!ÚsendRemoteCommEvent†s



ÿz3SupervisorNamespaceRPCInterface.sendRemoteCommEventN)F)T)T)T)T)T)T)0Ú__name__Ú
__module__Ú__qualname__r"r)r*Z
getVersionr-r.r/r3r4ZreadMainLogrArIrJrKrSrXrfrhrirqr~rrr†r‡rŠr‹rŒr¼r½rÀrÁrÅrÆZreadProcessLogrÊrÌrÍZtailProcessLogrÏrÐrÝrÑrÞrær r r r!r.sZ	


J


3


/.
-&rcCs|jd|jd|jdS)Ni€Qi@B)ZdaysZsecondsZmicroseconds)r¹r r r!r¸™s
ÿÿr¸cKs"g}g}||||||fdd„}|S)zl Return a closure representing a function that calls a
    function for every process, and returns a result cSs€|sÄ|D]º\}}t|jj|jjƒ}||ƒrz||f|Ž}	WnJtk
r„}
z,| |jj|jj|
j|
jdœ¡WY¢qW5d}
~
XYnXt|	tj	ƒr¤| |||	f¡q| |jj|jjt
jddœ¡q|sÌ|S|dd…D]˜}|\}}}z
|ƒ}
WnNtk
r>}
z.| |jj|jj|
j|
jdœ¡| |¡W5d}
~
XYqØX|
t
k	rØ| |jj|jjt
jddœ¡| |¡qØ|r|t
S|S)NrÒrÓ)rrVrMrr^rÕr(r#ÚtypesÚFunctionTyperrÖrCr)r]Ú	predicateÚfuncÚextra_kwargsrÚrÛrPrdrMr×rØZstructÚcbÚvaluer r r!Úallfunc¤sb	
ýýÿ

ýÿýÿzmake_allfunc.<locals>.allfuncr )r]rìrírîrÚrÛrñr r r!r{sú
Qr{cCs| ¡tkSr)rmrr€r r r!r„÷sr„cCs
t|ƒSr)r„r€r r r!r|úsr|cCst|ƒSr)rrr r r!Úmake_main_rpcinterfaceþsrò),r6r¶rµrârêZsupervisor.compatrrrZsupervisor.datatypesrrZsupervisor.optionsrrr	r
rrr
rZsupervisor.eventsrrZsupervisor.httprZsupervisor.xmlrpcrrrZsupervisor.statesrrrrrrr+rr¸r{r„r|ròr r r r!Ú<module>sLqZ