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.opt-1.pyc
Size: Mime:
3

ÿn‚a¸-ã@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.



cCs$tjƒtjƒdaaaadS)N)r#rr$r&r'rrrrrlscGstj|ƒ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__Ústaticmethodr/rrrrr%†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)r4r/)r5r-r.rrrr/‘sz)RequestContextSerializer.serialize_entitycCs|js
|S|jj||ƒS)N)r4Údeserialize_entity)r5r-r.rrrr8–sz+RequestContextSerializer.deserialize_entitycCs|jƒS)N)Zto_dict)r5r-rrrÚserialize_context›sz*RequestContextSerializer.serialize_contextcCstjjj|ƒS)N)Údmapir-ÚRequestContextZ	from_dict)r5r-rrrÚdeserialize_contextžsz,RequestContextSerializer.deserialize_contextN)r0r1r2r7r/r8r9r<rrrrrŒs
cCstjjt|tƒS)N)rZTransportURLÚparseÚCONFr)Zurl_strrrrÚget_transport_url¢sr?cCs>tjj}tjjgg}tj||d}t|ƒ}tj||||dS)N)r )Úversion_capr!)	r:rr>Ú	exceptionr0rr"rÚ	RPCClient)Útargetr@r!rr(r#rrrr¦scCst|ƒ}tjt||d|dS)NZeventlet)Úexecutorr!)rrZget_rpc_serverr#)rCZ	endpointsr!rrrr	³scCs&|sd||ptjf}ttj|dƒS)Nz%s.%s)Úpublisher_id)r>rÚLegacyValidatingNotifierr&Úprepare)ZservicerrErrrr
½scCstj|dS)N)rE)r'rG)rErrrÚget_versioned_notifierÅsrHcCstƒ}tjt||dS)N)Úurlr )rrr"r>)rIr(rrrÚcreate_transportÊsrJc@s:eZdZdZdZdgZedƒZdd„Zdd„Z	d	d
„Z
dS)rFzDWraps 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)rKrLrMrNrO)ÚnotifierÚsetattrÚ	functoolsÚpartialÚ_notify)r5rPÚpriorityrrrr7ås
z!LegacyValidatingNotifier.__init__cCsddht|jƒƒkS)NrAr+)ÚsetÚkeys)r5Ú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_typesrYÚfatalÚAssertionErrorÚmessageÚLOGZwarningÚgetattrrP)r5rUZctxtrZrXrrrrTôs
z LegacyValidatingNotifier._notifyN)r0r1r2Ú__doc__r\r[rr^r7rYrTrrrrrFÑs	rFc@s eZdZdd„Zedd„ƒZdS)Ú
ClientWrappercCs||_tjƒ|_dS)N)Ú_clientrÚutcnowÚlast_access_time)r5Úclientrrrr7szClientWrapper.__init__cCstjƒ|_|jS)N)rrdrerc)r5rrrrfs
zClientWrapper.clientN)r0r1r2r7Ú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)Úsuperrhr7r>ÚclientsrbrCr@r`r!Zrun_periodic_tasksr:r-r;)r5Zdefault_client)Ú	__class__rrr7szClientRouter.__init__NcCsj|r|j}nd}y|j|j}WnDtk
rdt|jƒ}tj||j|j	|j
d}t|ƒ|j|<YnX|S)Nr)r@r!)ZuuidrjrfÚKeyErrorrJZ
transport_urlrrBrCr@r!rb)r5r-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_rK)rmre)ÚtimeoutrrÚstale2s
z1ClientRouter._remove_stale_clients.<locals>.staler)ÚlistrjÚitemsre)r5r-rpZ
items_copyrmZclient_wrapperr)rorÚ_remove_stale_clients.sz"ClientRouter._remove_stale_clients)N)	r0r1r2rar7rcrrsÚ
__classcell__rr)rkrrh
s
rh)N)NN)N)NN)7Ú__all__rRZoslo_logr
ZloggingZoslo_messagingrZoslo_serializationrZoslo_servicerZ
oslo_utilsrZ
dmapi.confr:Zdmapi.exceptionZ
dmapi.i18nrrr>Z	getLoggerr0r_r#r&r$r'rAr,r)rrZoslo_configrrrrrrrZNoOpSerializerr%Z
Serializerrr?rr	r
rHrJÚobjectrFrbZ
PeriodicTasksrhrrrrÚ<module>sb






.