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.6 / site-packages / dmapi / __pycache__ / rpc.cpython-36.pyc
Size: Mime:
3

r`e¸-ã@sˆdddddddddd	d
gZddlZdd
lmZddlZddlmZddl	m
Z
ddlmZddl
ZddlZddlmZejjZejeƒZdadadadaejjgZgZddddœZdd„Zddl m!Z!dd„Z"dd„Z#dd„Z$dd„Z%dd„Z&dd„Z'Gdd „d ej(ƒZ)Gd!d„dej*ƒZ+d1d"d#„Z,d2d$d„Z-d3d%d„Z.d4d&d	„Z/d'd(„Z0d)d*„Z1Gd+d,„d,e2ƒZ3Gd-d.„d.e2ƒZ4Gd/d0„d0e
j5ƒZ6dS)5Ú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)Ú_ZrabbitZqpidZzmq)zdmapi.rpc.impl_kombuzdmapi.rpc.impl_qpidzdmapi.rpc.impl_zmqcCstj|ƒdS)N)Ú	messagingZset_transport_defaults)Zcontrol_exchange©rú/usr/lib/python3.6/rpc.pyr7s)ÚcfgcCs:tjddddgddddtjdd	d
g}|}|j|ƒdS)NÚnotification_formatÚunversionedZ	versionedÚbothZDEFAULTÚ)ÚchoicesÚdefaultZdeprecated_groupÚhelpÚhostz   )r)rZStrOptZHostAddressOptÚ
register_opts)ÚconfZnotification_optsZALL_OPTSrrrr=s
rcCs°t|ƒtƒ}tj||datj||dattƒƒ}|j	dkr^tj
t|datj
t|ddanN|j	dkrŠtj
t|datj
t|dgdan"tj
t|ddatj
t|dgdadS)	N)Úallowed_remote_exmodsr)Ú
serializerZnoop)r!ZdriverrZversioned_notifications)r!Ztopics)
rrrÚ
get_transportÚ	TRANSPORTZget_notification_transportÚNOTIFICATION_TRANSPORTrÚJsonPayloadSerializerrZNotifierÚLEGACY_NOTIFIERÚNOTIFIER)rÚexmodsr!rrrrOs.



cCsTtdk	st‚tdk	st‚tdk	s$t‚tdk	s0t‚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@seZdZedd„ƒZdS)r%cCstj|ddS)NT)Zconvert_instances)rZto_primitive)ÚcontextÚentityrrrÚserialize_entity‡sz&JsonPayloadSerializer.serialize_entityN)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr0rrrrr%†sr%c@s4eZdZdd„Zdd„Zdd„Zdd„Zd	d
„ZdS)rcCs
||_dS)N)Ú_base)ÚselfÚbaserrrÚ__init__Žsz!RequestContextSerializer.__init__cCs|js
|S|jj||ƒS)N)r5r0)r6r.r/rrrr0‘sz)RequestContextSerializer.serialize_entitycCs|js
|S|jj||ƒS)N)r5Údeserialize_entity)r6r.r/rrrr9–sz+RequestContextSerializer.deserialize_entitycCs|jƒS)N)Zto_dict)r6r.rrrÚserialize_context›sz*RequestContextSerializer.serialize_contextcCstjjj|ƒS)N)Údmapir.ÚRequestContextZ	from_dict)r6r.rrrÚdeserialize_contextžsz,RequestContextSerializer.deserialize_contextN)r1r2r3r8r0r9r:r=rrrrrŒs
cCstjjt|tƒS)N)rZTransportURLÚparseÚCONFr)Zurl_strrrrÚget_transport_url¢sr@cCsJtjj}tjjgg}tj||d}|dk	s0t‚t|ƒ}tj	||||dS)N)r )Úversion_capr!)
r;rr?Ú	exceptionr1rr"r)rÚ	RPCClient)ÚtargetrAr!rr(r#rrrr¦scCs(tdk	st‚t|ƒ}tjt||d|dS)NZeventlet)Úexecutorr!)r#r)rrZget_rpc_server)rDZ	endpointsr!rrrr	³scCs2tdk	st‚|s"d||ptjf}ttj|dƒS)Nz%s.%s)Úpublisher_id)r&r)r?rÚLegacyValidatingNotifierÚprepare)ZservicerrFrrrr
½s
cCstdk	st‚tj|dS)N)rF)r'r)rH)rFrrrÚget_versioned_notifierÅsrIcCstƒ}tjt||dS)N)Úurlr )rrr"r?)rJr(rrrÚcreate_transportÊsrKc@s:eZdZdZdZdgZedƒZdd„Zdd„Z	d	d
„Z
dS)rGzDWraps 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.rstcCs.||_x"dD]}t||tj|j|ƒƒqWdS)NÚdebugÚinfoÚwarnÚerrorÚcritical)rLrMrNrOrP)ÚnotifierÚsetattrÚ	functoolsÚpartialÚ_notify)r6rQÚpriorityrrrr8ås
z!LegacyValidatingNotifier.__init__cCsddht|jƒƒkS)NrBr,)ÚsetÚkeys)r6ÚpayloadrrrÚ_is_wrap_exception_notificationësz8LegacyValidatingNotifier._is_wrap_exception_notificationcCsZ||jkrB|j|ƒrB|jr0t|jd|iƒ‚ntj|jd|iƒt|j|ƒ|||ƒdS)NÚ
event_type)	Ú'allowed_legacy_notification_event_typesrZÚfatalr)ÚmessageÚLOGZwarningÚgetattrrQ)r6rVZctxtr[rYrrrrUôs
z LegacyValidatingNotifier._notifyN)r1r2r3Ú__doc__r]r\rr^r8rZrUrrrrrGÑs	rGc@s eZdZdd„Zedd„ƒZdS)Ú
ClientWrappercCs||_tjƒ|_dS)N)Ú_clientrÚutcnowÚlast_access_time)r6Úclientrrrr8szClientWrapper.__init__cCstjƒ|_|jS)N)rrdrerc)r6rrrrfs
zClientWrapper.clientN)r1r2r3r8Úpropertyrfrrrrrbÿsrbcs8eZdZdZ‡fdd„Zd	dd„Zejdd„ƒZ‡ZS)
Ú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.
    csZtt|ƒjtƒi|_t|ƒ|jd<|j|_|j|_t|ddƒ|_	|j
tjj
ddƒdS)Nrr!F)Z	overwrite)Úsuperrhr8r?ÚclientsrbrDrAr`r!Zrun_periodic_tasksr;r.r<)r6Zdefault_client)Ú	__class__rrr8szClientRouter.__init__NcCsj|r|j}nd}y|j|j}WnDtk
rdt|jƒ}tj||j|j	|j
d}t|ƒ|j|<YnX|S)Nr)rAr!)ZuuidrjrfÚKeyErrorrKZ
transport_urlrrCrDrAr!rb)r6r.Zcell_mappingÚ	client_idrfZ	transportrrrrcs


zClientRouter._clientcsPd‰‡fdd„}t|jjƒƒ}x,|D]$\}}|dkr$|||jƒr$|j|=q$WdS)Né<cs"tj|ˆƒrtjd||ƒdSdS)Nz;Removing stale RPC client: %s as it was last accessed at %sTF)rZ
is_older_thanr_rL)rmre)ÚtimeoutrrÚstale2s
z1ClientRouter._remove_stale_clients.<locals>.staler)ÚlistrjÚitemsre)r6r.rpZ
items_copyrmZclient_wrapperr)rorÚ_remove_stale_clients.sz"ClientRouter._remove_stale_clients)N)	r1r2r3rar8rcrrsÚ
__classcell__rr)rkrrh
s
rh)N)NN)N)NN)7Ú__all__rSZoslo_logr
ZloggingZoslo_messagingrZoslo_serializationrZoslo_servicerZ
oslo_utilsrZ
dmapi.confr;Zdmapi.exceptionZ
dmapi.i18nrrr?Z	getLoggerr1r_r#r&r$r'rBr-r*rrZoslo_configrrrrrrrZNoOpSerializerr%Z
Serializerrr@rr	r
rIrKÚobjectrGrbZ
PeriodicTasksrhrrrrÚ<module>sb






.