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    
python3-dmapi / usr / lib / python3 / dist-packages / dmapi / __pycache__ / rpc.cpython-35.pyc
Size: Mime:


èáþ\¸-ã@s@dddddddddd	d
gZddlZdd
lmZddlZddlmZddl	m
Z
ddlmZddl
ZddlZddlmZejjZejeƒZdadadadaejjgZgZddddddiZdd„Zddl m!Z!dd„Z"dd„Z#dd„Z$dd„Z%dd„Z&d d„Z'Gd!d"„d"ej(ƒZ)Gd#d„dej*ƒZ+dd$d%„Z,ddd&d„Z-dd'd„Z.ddd(d	„Z/d)d*„Z0d+d,„Z1Gd-d.„d.e2ƒZ3Gd/d0„d0e2ƒZ4Gd1d2„d2e
j5ƒZ6dS)3ÚinitÚcleanupÚset_defaultsÚadd_extra_exmodsÚclear_extra_exmodsÚget_allowed_exmodsÚRequestContextSerializerÚ
get_clientÚ
get_serverÚget_notifierÚTRANSPORT_ALIASESéN)Úlog)Ú	jsonutils)Ú
periodic_task)Ú	timeutils)Ú_zdmapi.rpc.impl_kombuZrabbitzdmapi.rpc.impl_qpidZqpidzdmapi.rpc.impl_zmqZzmqcCstj|ƒdS)N)Ú	messagingZset_transport_defaults)Zcontrol_exchange©rú+/usr/lib/python3/dist-packages/dmapi/rpc.pyr7s)Úcfgc
Cs\tjdddddgddddd	d
ƒtjdd	dƒg}|}|j|ƒdS)
NÚnotification_formatÚchoicesÚunversionedZ	versionedÚbothÚdefaultZdeprecated_groupÚDEFAULTÚhelpÚÚhostz   )rZStrOptZHostAddressOptÚ
register_opts)ÚconfZnotification_optsZALL_OPTSrrrr=srcCst|ƒtƒ}tj|d|ƒatj|d|ƒattƒƒ}|j	dkrŽtj
td|ƒatj
td|ddƒan~|j	dkrÓtj
td|ƒatj
td|ddgƒan9tj
td|ddƒatj
td|ddgƒadS)	NÚallowed_remote_exmodsrÚ
serializerÚdriverZnooprZtopicsZversioned_notifications)
rrrÚ
get_transportÚ	TRANSPORTZget_notification_transportÚNOTIFICATION_TRANSPORTrÚJsonPayloadSerializerrZNotifierÚLEGACY_NOTIFIERÚNOTIFIER)r Úexmodsr"rrrrOs.
				cCsrtdk	st‚tdk	s$t‚tdk	s6t‚tdk	sHt‚tjƒtjƒdaaaadS)N)r%ÚAssertionErrorr&r(r)rrrrrrls

cGstj|ƒdS)N)ÚEXTRA_EXMODSÚextend)ÚargsrrrrzscCstdd…=dS)N)r,rrrrr~scCsttS)N)ÚALLOWED_EXMODSr,rrrrr‚sc@s"eZdZedd„ƒZdS)r'cCstj|ddƒS)NZconvert_instancesT)rZto_primitive)ÚcontextÚentityrrrÚserialize_entity‡sz&JsonPayloadSerializer.serialize_entityN)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr2rrrrr'†sr'c@sLeZdZdd„Zdd„Zdd„Zdd„Zd	d
„ZdS)rcCs
||_dS)N)Ú_base)ÚselfÚbaserrrÚ__init__Žsz!RequestContextSerializer.__init__cCs |js
|S|jj||ƒS)N)r7r2)r8r0r1rrrr2‘s	z)RequestContextSerializer.serialize_entitycCs |js
|S|jj||ƒS)N)r7Údeserialize_entity)r8r0r1rrrr;–s	z+RequestContextSerializer.deserialize_entitycCs
|jƒS)N)Zto_dict)r8r0rrrÚserialize_context›sz*RequestContextSerializer.serialize_contextcCstjjj|ƒS)N)Údmapir0ÚRequestContextZ	from_dict)r8r0rrrÚdeserialize_contextžsz,RequestContextSerializer.deserialize_contextN)r3r4r5r:r2r;r<r?rrrrrŒs
cCstjjt|tƒS)N)rZTransportURLÚparseÚCONFr)Zurl_strrrrÚget_transport_url¢srBcCsntjj}tjjgg}tj|d|ƒ}|dk	sFt‚t|ƒ}tj	||d|d|ƒS)Nr!Úversion_capr")
r=r rAÚ	exceptionr3rr$r+rÚ	RPCClient)ÚtargetrCr"r r*r%rrrr¦s	cCs=tdk	st‚t|ƒ}tjt||ddd|ƒS)NZexecutorZeventletr")r%r+rrZget_rpc_server)rFZ	endpointsr"rrrr	³s	cCsGtdk	st‚|s1d||p*tjf}ttjd|ƒƒS)Nz%s.%sÚpublisher_id)r(r+rArÚLegacyValidatingNotifierÚprepare)ÚservicerrGrrrr
½s
cCs"tdk	st‚tjd|ƒS)NrG)r)r+rI)rGrrrÚget_versioned_notifierÅsrKcCs"tƒ}tjtd|d|ƒS)NÚurlr!)rrr$rA)rLr*rrrÚcreate_transportÊs	rMc@sUeZdZdZdZdgZedƒZdd„Zdd„Z	d	d
„Z
dS)rHzDWraps an oslo.messaging Notifier and checks for allowed event_types.Fzaggregate.addhost.endze%(event_type)s is not a versioned notification and not whitelisted. See ./doc/source/notification.rstcCsL||_x<dddddgD]%}t||tj|j|ƒƒqWdS)NÚdebugÚinfoÚwarnÚerrorÚcritical)ÚnotifierÚsetattrÚ	functoolsÚpartialÚ_notify)r8rSÚpriorityrrrr:ås		z!LegacyValidatingNotifier.__init__cCsddht|jƒƒkS)NrDr.)ÚsetÚkeys)r8ÚpayloadrrrÚ_is_wrap_exception_notificationësz8LegacyValidatingNotifier._is_wrap_exception_notificationcCs}||jkr]|j|ƒr]|jrDt|jd|iƒ‚ntj|jd|iƒt|j|ƒ|||ƒdS)NÚ
event_type)	Ú'allowed_legacy_notification_event_typesr\Úfatalr+ÚmessageÚLOGÚwarningÚgetattrrS)r8rXZctxtr]r[rrrrWôs	z LegacyValidatingNotifier._notifyN)r3r4r5Ú__doc__r_r^rr`r:r\rWrrrrrHÑs		rHc@s.eZdZdd„Zedd„ƒZdS)Ú
ClientWrappercCs||_tjƒ|_dS)N)Ú_clientrÚutcnowÚlast_access_time)r8Úclientrrrr:s	zClientWrapper.__init__cCstjƒ|_|jS)N)rrgrhrf)r8rrrriszClientWrapper.clientN)r3r4r5r:ÚpropertyrirrrrreÿsrecsLeZdZdZ‡fdd†Zddd„Zejdd„ƒZ‡S)	ÚClientRouterzËCreates and caches RPC clients that route to cells or the default.

    The default client connects to the API cell message queue. The rest of the
    clients connect to compute cell message queues.
    cstt|ƒjtƒi|_t|ƒ|jd<|j|_|j|_t|ddƒ|_	|j
tjj
ddƒƒdS)Nrr"Z	overwriteF)Úsuperrkr:rAÚclientsrerFrCrcr"Zrun_periodic_tasksr=r0r>)r8Zdefault_client)Ú	__class__rrr:s	zClientRouter.__init__Nc
CsŽ|r|j}nd}y|j|j}Wn[tk
r‰t|jƒ}tj||jd|j	d|j
ƒ}t|ƒ|j|<YnX|S)NrrCr")ZuuidrmriÚKeyErrorrMZ
transport_urlrrErFrCr"re)r8r0Zcell_mappingÚ	client_idriZ	transportrrrrfs
	zClientRouter._clientcspd‰‡fdd†}t|jjƒƒ}x<|D]4\}}|dkr4|||jƒr4|j|=q4WdS)Né<cs-tj|ˆƒr)tjd||ƒdSdS)Nz;Removing stale RPC client: %s as it was last accessed at %sTF)rZ
is_older_thanrarN)rprh)ÚtimeoutrrÚstale2s
	
z1ClientRouter._remove_stale_clients.<locals>.staler)ÚlistrmÚitemsrh)r8r0rsZ
items_copyrpZclient_wrapperr)rrrÚ_remove_stale_clients.sz"ClientRouter._remove_stale_clients)r3r4r5rdr:rfrrvrr)rnrrk
s
rk)7Ú__all__rUZoslo_logr
ÚloggingZoslo_messagingrZoslo_serializationrZoslo_servicerZ
oslo_utilsrZ
dmapi.confr=Zdmapi.exceptionZ
dmapi.i18nrr rAÚ	getLoggerr3rar%r(r&r)rDr/r,rrZoslo_configrrrrrrrZNoOpSerializerr'Z
SerializerrrBrr	r
rKrMÚobjectrHreZ
PeriodicTasksrkrrrrÚ<module>sb	

.