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    
Size: Mime:
a

j;gm*ã@s~gd¢ZddlZddlmZddlZddlmZddl	m
Z
ddlmZddl
ZddlZddlmZejjZe e¡ZdadadadaejjgZgZdd	d
dœZdd
„Zddl m!Z!dd„Z"dd„Z#dd„Z$dd„Z%dd„Z&dd„Z'Gdd„dej(ƒZ)Gdd„dej*ƒZ+d3dd „Z,d4d!d"„Z-d5d#d$„Z.d6d%d&„Z/d'd(„Z0d)d*„Z1Gd+d,„d,e2ƒZ3Gd-d.„d.e2ƒZ4Gd/d0„d0e
j5ƒZ6d1d2„Z7dS)7)Ú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)zcontego.rpc.impl_kombuzcontego.rpc.impl_qpidzcontego.rpc.impl_zmqcCst |¡dS©N)Ú	messagingZset_transport_defaults)Zcontrol_exchange©rú//usr/lib/python3.9/site-packages/contego/rpc.pyr2sr)ÚcfgcCs,tjdgd¢ddddg}|}| |¡dS)NÚnotification_format)ÚunversionedÚ	versionedÚbothrZDEFAULTÚ)ÚchoicesÚdefaultZdeprecated_groupÚhelp)rZStrOptÚ
register_opts)ÚconfZnotification_optsZALL_OPTSrrrr6sûÿ
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#rrrrEs<ÿ

ÿÿ
ÿþþþrcCs$t ¡t ¡daaaadSr)r%rr&r(r)rrrrrbsrcGst |¡dSr)ÚEXTRA_EXMODSÚextend)ÚargsrrrrpsrcCstdd…=dSr)r+rrrrrtsrcCsttSr)ÚALLOWED_EXMODSr+rrrrrxsrc@seZdZedd„ƒZdS)r'cCstj|ddS)NT)Zconvert_instances)rZto_primitive)ÚcontextÚentityrrrÚserialize_entity}sz&JsonPayloadSerializer.serialize_entityN)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr1rrrrr'|sr'c@s4eZdZdd„Zdd„Zdd„Zdd„Zd	d
„ZdS)rcCs
||_dSr)Ú_base)ÚselfÚbaserrrÚ__init__„sz!RequestContextSerializer.__init__cCs|js
|S|j ||¡Sr)r6r1©r7r/r0rrrr1‡sz)RequestContextSerializer.serialize_entitycCs|js
|S|j ||¡Sr)r6Údeserialize_entityr:rrrr;Œsz+RequestContextSerializer.deserialize_entitycCs| ¡Sr)Zto_dict©r7r/rrrÚserialize_context‘sz*RequestContextSerializer.serialize_contextcCstjj |¡Sr)Úcontegor/ÚRequestContextZ	from_dictr<rrrÚdeserialize_context”sz,RequestContextSerializer.deserialize_contextN)r2r3r4r9r1r;r=r@rrrrr‚s
rcCstj t|t¡Sr)rZTransportURLÚparseÚCONFr)Zurl_strrrrÚget_transport_url˜srCcCs>tjj}tjjgg}tj||d}t|ƒ}tj||||dS)Nr!©Úversion_capr#)	r>r rBÚ	exceptionr2rr$rÚ	RPCClient)ÚtargetrEr#r r*r%rrrrœsýrcCst|ƒ}tjt||d|dS)NZeventlet)Úexecutorr#)rrZget_rpc_serverr%)rHZ	endpointsr#rrrr	©sür	cCs&|sd||ptjf}ttj|dƒS)Nz%s.%s©Úpublisher_id)rBÚhostÚLegacyValidatingNotifierr(Úprepare)ZservicerLrKrrrr
³s

ÿr
cCstj|dS)NrJ)r)rNrJrrrÚget_versioned_notifier»srOcCstƒ}tjt||dS)N)Úurlr")rrr$rB)rPr*rrrÚcreate_transportÀs
þrQc@s:eZdZdZdZdgZedƒZdd„Zdd„Z	d	d
„Z
dS)rMzDWraps 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*||_dD]}t||t |j|¡ƒq
dS)N)ÚdebugÚinfoÚwarnÚerrorZcritical)ÚnotifierÚsetattrÚ	functoolsÚpartialÚ_notify)r7rVÚpriorityrrrr9Ûs
ÿz!LegacyValidatingNotifier.__init__cCsddht| ¡ƒkS)NrFr-)ÚsetÚkeys)r7ÚpayloadrrrÚ_is_wrap_exception_notificationász8LegacyValidatingNotifier._is_wrap_exception_notificationcCsX||jvr@| |¡s@|jr.t|jd|iƒ‚nt |jd|i¡t|j|ƒ|||ƒdS)NÚ
event_type)	Ú'allowed_legacy_notification_event_typesr_ÚfatalÚAssertionErrorÚmessageÚLOGZwarningÚgetattrrV)r7r[Zctxtr`r^rrrrZês
ÿz LegacyValidatingNotifier._notifyN)r2r3r4Ú__doc__rbrarrdr9r_rZrrrrrMÇsÿ	rMc@s eZdZdd„Zedd„ƒZdS)Ú
ClientWrappercCs||_t ¡|_dSr)Ú_clientrÚutcnowÚlast_access_time)r7Úclientrrrr9öszClientWrapper.__init__cCst ¡|_|jSr)rrjrkri)r7rrrrlús
zClientWrapper.clientN)r2r3r4r9Úpropertyrlrrrrrhõsrhcs8eZdZdZ‡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|ƒ t¡i|_t|ƒ|jd<|j|_|j|_t|ddƒ|_	| 
tjj
dd¡dS)Nrr#F)Z	overwrite)Úsuperrnr9rBÚclientsrhrHrErfr#Zrun_periodic_tasksr>r/r?)r7Zdefault_client©Ú	__class__rrr9szClientRouter.__init__Nc	Csh|r|j}nd}z|j|j}WnBtybt|jƒ}tj||j|j	|j
d}t|ƒ|j|<Yn0|S)NrrD)ZuuidrprlÚKeyErrorrQZ
transport_urlrrGrHrEr#rh)r7r/Zcell_mappingÚ	client_idrlZ	transportrrrris

þzClientRouter._clientcsLd‰‡fdd„}t|j ¡ƒ}|D]$\}}|dkr"|||jƒr"|j|=q"dS)Né<cs"t |ˆ¡rt d||¡dSdS)Nz;Removing stale RPC client: %s as it was last accessed at %sTF)rZ
is_older_thanrerR)rtrk©ÚtimeoutrrÚstale&sÿz1ClientRouter._remove_stale_clients.<locals>.staler)ÚlistrpÚitemsrk)r7r/rxZ
items_copyrtZclient_wrapperrrvrÚ_remove_stale_clients"s
ÿz"ClientRouter._remove_stale_clients)N)	r2r3r4rgr9rirr{Ú
__classcell__rrrqrrns

rncst ˆ¡‡fdd„ƒ}|S)zCCalls decorated method only if versioned notifications are enabled.cs*t ¡r"tjjdvr"ˆ|i|¤ŽSdSdS)N)rr)r)Z
is_enabledrBZ
notificationsr)r-Úkwargs©ÚfrrÚwrapped7s

ÿz)if_notifications_enabled.<locals>.wrapped)rXÚwraps)rr€rr~rÚif_notifications_enabled5sr‚)N)NN)N)NN)8Ú__all__rXZoslo_logr
ZloggingZoslo_messagingrZoslo_serializationrZoslo_servicerZ
oslo_utilsrZcontego.confr>Zcontego.exceptionZcontego.i18nrr rBZ	getLoggerr2rer%r(r&r)rFr.r+rrZoslo_configrrrrrrrZNoOpSerializerr'Z
SerializerrrCrr	r
rOrQÚobjectrMrhZ
PeriodicTasksrnr‚rrrrÚ<module>sR

ý




.5