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:
3

nS
bm*ã@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+d3d"d#„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„Z7dS)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_zmqcCstj|ƒdS)N)Ú	messagingZset_transport_defaults)Zcontrol_exchange©rú/usr/lib/python3.6/rpc.pyr2s)ÚcfgcCs.tjddddgddddg}|}|j|ƒdS)NÚnotification_formatÚunversionedÚ	versionedÚbothZDEFAULTÚ)Ú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.



cCsTtdk	st‚tdk	st‚tdk	s$t‚tdk	s0t‚tjƒtjƒdaaaadS)N)r#ÚAssertionErrorr$r&r'rrrrrrbscGstj|ƒdS)N)ÚEXTRA_EXMODSÚextend)ÚargsrrrrpscCstdd…=dS)N)r*rrrrrtscCsttS)N)ÚALLOWED_EXMODSr*rrrrrxsc@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)Úcontegor.Ú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?ÚhostÚLegacyValidatingNotifierÚprepare)ZservicerGrFrrrr
³s
cCstdk	st‚tj|dS)N)rF)r'r)rI)rFrrrÚget_versioned_notifier»srJcCstƒ}tjt||dS)N)Úurlr )rrr"r?)rKr(rrrÚcreate_transportÀsrLc@s:eZdZdZdZdgZedƒ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.rstcCs.||_x"dD]}t||tj|j|ƒƒqWdS)NÚdebugÚinfoÚwarnÚerrorÚcritical)rMrNrOrPrQ)ÚnotifierÚsetattrÚ	functoolsÚpartialÚ_notify)r6rRÚ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_typesr[Úfatalr)ÚmessageÚLOGZwarningÚgetattrrR)r6rWZctxtr\rZrrrrVês
z LegacyValidatingNotifier._notifyN)r1r2r3Ú__doc__r^r]rr_r8r[rVrrrrrHÇs	rHc@s eZdZdd„Zedd„ƒZdS)Ú
ClientWrappercCs||_tjƒ|_dS)N)Ú_clientrÚutcnowÚlast_access_time)r6Úclientrrrr8öszClientWrapper.__init__cCstjƒ|_|jS)N)rrerfrd)r6rrrrgús
zClientWrapper.clientN)r1r2r3r8Úpropertyrgrrrrrcõsrccs8eZdZdZ‡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)Úsuperrir8r?ÚclientsrcrDrArar!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!)ZuuidrkrgÚKeyErrorrLZ
transport_urlrrCrDrAr!rc)r6r.Zcell_mappingÚ	client_idrgZ	transportrrrrds


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`rM)rnrf)ÚtimeoutrrÚstale&s
z1ClientRouter._remove_stale_clients.<locals>.staler)ÚlistrkÚitemsrf)r6r.rqZ
items_copyrnZclient_wrapperr)rprÚ_remove_stale_clients"sz"ClientRouter._remove_stale_clients)N)	r1r2r3rbr8rdrrtÚ
__classcell__rr)rlrris
ricstjˆƒ‡fdd„ƒ}|S)zCCalls decorated method only if versioned notifications are enabled.cs&tjƒrtjjdkrˆ||ŽSdSdS)Nrr)rr)r'Z
is_enabledr?Z
notificationsr)r,Úkwargs)ÚfrrÚwrapped7s

z)if_notifications_enabled.<locals>.wrapped)rTÚwraps)rwrxr)rwrÚif_notifications_enabled5srz)N)NN)N)NN)8Ú__all__rTZoslo_logr
ZloggingZoslo_messagingrZoslo_serializationrZoslo_servicerZ
oslo_utilsrZcontego.confr;Zcontego.exceptionZcontego.i18nrrr?Z	getLoggerr1r`r#r&r$r'rBr-r*rrZoslo_configrrrrrrrZNoOpSerializerr%Z
Serializerrr@rr	r
rJrLÚobjectrHrcZ
PeriodicTasksrirzrrrrÚ<module>sd






.5