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    
dmapi / usr / lib / python2.7 / dist-packages / dmapi / service.pyc
Size: Mime:
ó
Éec@sAdZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZ
ddlmZddlmZddlmZdd	lmZddlZdd
lmZmZmZmZmZmZm Z m!Z!m"Z"ddlm#Z#ddl$m%Z%m&Z&m'Z'm(Z(ej)d
ƒZ*ej)dƒZ+ej)dƒZ,ej-e.ƒZ/ej0j1Z1iZ2e
j3dddddƒe
j3dddddƒgZ4d„Z5d„Z6d„Z7d„Z8dej9fd„ƒYZ9dej9fd„ƒYZ:d „Z;da=dd!„Z>d"„Z?ddd#„Z@dS($s:Generic Node base class for all workers that run on hosts.iÿÿÿÿN(tprocessutils(tcfg(toptions(tlog(topts(tservice(timportutils(	tbaserpctcontexttdebuggert	exceptiontprofilertrpctutilstversiontwsgi(tdefaults(t_t_LEt_LIt_LWsosprofiler.optst
osprofilersosprofiler.initializerthttp_timeouttdefaultiXthelpsETimeout seconds for HTTP requests. Set it to None to disable timeout.tevaluation_intervali<soPeriod of evaluation cycle, should be >= than configured pipeline interval for collection of underlying meters.cCsJtj|ƒ}|j|_|j|_|j|_d|_|jƒ|S(Ni(tobjectstServicethosttbinaryttopictreport_counttcreate(tthis_serviceRR((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyt_create_service_ref4s	
cCsm|jtjkritjtdƒi|jd6|jd6|jd6tjd6ƒtj|_|jƒndS(NsKUpdating service version for %(binary)s on %(host)s from %(old)i to %(new)iRRtoldtnew(	Rtservice_objtSERVICE_VERSIONtLOGtinfoRRRtsave(R((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyt_update_service_ref>s


cCsctr_tjjr_tjjdtdtjƒjƒddd|d|ƒt	j
tdƒƒndS(NtconfRtprojecttdmapiRRsOSProfiler is enabled.(RtCONFRtenabledtinitializertinit_from_confRtget_admin_contexttto_dictR'R(R(RR((s1/usr/lib/python2.7/dist-packages/dmapi/service.pytsetup_profilerJscCsLddlj}ddl}|jƒ}|j|jk	rHtdƒ‚ndS(Niÿÿÿÿsgeventlet hub is not using a monotonic clock - periodic tasks will be affected by drifts of system time.(t
eventlet.hubsthubst	monotonictget_hubtclocktRuntimeError(R6R7thub((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyt$assert_eventlet_uses_monotonic_clockUsRc
Bs•eZdZddddd„Zd„Zd„Zd„Zeddddddddd„ƒZ	d„Z
d„Zed„Z
d	„Zd
„ZRS(sõService object for binaries running on hosts.

    A service takes a manager and enables rpc by listening to queues based
    on topic. It also periodically runs tasks on the manager and reports
    its state to the database services table.
    c	
Osþtt|ƒjƒ||_||_||_||_tjƒ|_	t
j|jƒ}|d|j|	|
Ž|_d|_||_||_||_||_|	|
|_|_d|_tjjrêtjƒ}|jtjƒƒnt||jƒdS(NR(tsuperRt__init__RRRtmanager_class_nametservicegrouptAPItservicegroup_apiRtimport_classtmanagertNonet	rpcservertreport_intervaltperiodic_enabletperiodic_fuzzy_delaytperiodic_interval_maxt
saved_argstsaved_kwargst
backdoor_porttobjects_baset
NovaObjecttindirection_apit	conductortwait_until_readyRR2R4(
tselfRRRRDRGRHRIRJtargstkwargst
manager_classt
conductor_api((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR>hs&										cCs3di|jjd6|jd6|jd6|jd6S(NsP<%(cls_name)s: host=%(host)s, binary=%(binary)s, manager_class_name=%(manager)s>tcls_nameRRRD(t	__class__t__name__RRR?(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyt__repr__s


cCsYtƒtjƒ}tjtdƒi|jd6|d6ƒ|jƒ|jj	ƒt
|_tj
ƒ}tjj||j|jƒ|_|jr t|jƒnWyt||ƒ|_Wn>tjtjfk
rötjj||j|jƒ|_nX|jjƒ|jd
k	r%|j|j_ntjd|jƒtjd|jd|jƒ}|jtj |jj!|jƒg}|j"|jj#ƒt$j%ƒ}t&j'|||ƒ|_(|j(j)ƒ|jj*ƒtjd|jƒ|j+j,|j|j|ƒ|j-rU|j.r*t/j0ƒj1d|j.ƒ}nd
}|j2j3|j4d|d	|j5ƒnd
S(suStart the service.

        This includes starting an RPC service, initializing
        periodic tasks, etc.
        s-Starting %(topic)s node (version %(version)s)RRs"Creating RPC server for service %stservers0Join ServiceGroup membership for this service %sit
initial_delayRJN(6R<Rtversion_string_with_packageR'R(RRtbasic_config_checkRDt	init_hosttFalsetmodel_disconnectedRR2RRtget_by_host_and_binaryRRtservice_refR*R"R
tServiceTopicExiststServiceBinaryExiststpre_start_hookRMREtdebugt	messagingtTargetRt
BaseRPCAPItservice_nametextendtadditional_endpointsRNtNovaObjectSerializerRt
get_serverRFtstarttpost_start_hookRBtjoinRHRItrandomtSystemRandomtrandintttgtadd_dynamic_timertperiodic_tasksRJ(RStverstrtctxtttargett	endpointst
serializerR]((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyRqˆsR

				


	
		cCs"|jjddƒ}t||ƒS(NRD(t__dict__tgetREtgetattr(RStkeyRD((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyt__getattr__Îsc	

Csë|stj}n|s4tjjtjdƒ}n|sP|jdƒd}n|shtj	|ƒ}n|dkr€tj}n|dkr˜tj}n|dkr°tj
}ntjƒ|||||d|d|d|d|ƒ}	|	S(	s7Instantiates class and passes back application object.

        :param host: defaults to CONF.host
        :param binary: defaults to basename of executable
        :param topic: defaults to bin_name - 'dmapi-' part
        :param manager: defaults to CONF.<topic>_manager
        :param report_interval: defaults to CONF.report_interval
        :param periodic_enable: defaults to CONF.periodic_enable
        :param periodic_fuzzy_delay: defaults to CONF.periodic_fuzzy_delay
        :param periodic_interval_max: if set, the max time to wait between runs

        isdmapi-iRGRHRIRJN(R.Rtostpathtbasenametsystargvt
rpartitiontSERVICE_MANAGERSR€RERGRHRIR	tinit(
tclsRRRRDRGRHRIRJR%((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR Òs*
	cCsI|jƒy|jjƒWn'tjk
rDtjtdƒƒnXdS(sþDestroy the service object in the datastore.

        NOTE: Although this method is not used anywhere else than tests, it is
        convenient to have it here, so the tests might easily and in clean way
        stop and remove the service_ref.

        s)Service killed that has no database entryN(tstopRdtdestroyR
tNotFoundR'twarningR(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pytkillûs

cCs–y|jjƒ|jjƒWn&tk
rF}tjt|ƒƒnXy|jjƒWn$tk
r~tjtdƒƒnXt	t
|ƒjƒdS(sstop the service and clean up.s*Service error occurred during cleanup_hostN(RFRtwaitt	ExceptionR'R
RRDtcleanup_hostR=R(RStex((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR	s

cCs"tjƒ}|jj|d|ƒS(s'Tasks to be run at a periodic interval.traise_on_error(RR2RDRy(RSR–R{((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyRyscCsTytjƒWdQXWn6tk
rO}tjtdƒ|ƒtjdƒnXdS(s7Perform basic config checks before starting processing.Ns"Temporary directory is invalid: %si(R
ttempdirR“R'terrorRR‡texit(RSte((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR_s

cCs|jjƒdS(sreset the service.N(RDtreset(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR›)sN(RZt
__module__t__doc__RER>R[RqRƒtclassmethodR R‘RRaRyR_R›(((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR`s 			F	&			
tWSGIServicecBsMeZdZdedd„Zd„Zd„Zd„Zd„Z	d„Z
RS(s<Provides ability to launch API from a 'paste' configuration.cCs~||_d||_d|_|jƒ|_|p=tjƒ|_|jj	|ƒ|_
|}ttd|dƒ|_
ttd|dƒ|_ttd|dƒp¯tjƒ|_|jr|jdkrd|}tdƒi|d	6t|jƒd
6}tj|ƒ‚n||_tj||j
d|j
d|jd
|jd|ƒ|_|jj|_d|_t||j
ƒdS(sÝInitialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param loader: Loads the WSGI application using the given name.
        :returns: None

        sdmapi-%ss	%s_listens0.0.0.0s%s_listen_portis
%s_workersisG%(worker_name)s value of %(workers)s is invalid, must be greater than 0tworker_nametworkersRtporttuse_ssltmax_url_lenN(tnameRRERt_get_managerRDRtLoadertloadertload_apptappRR.RR¢Rtget_worker_countR¡RtstrR
tInvalidInputR£tServerR\RMR4(RSR¥R¨R£R¤twnameR tmsg((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR>1s6	
	
	
							cCs|jjƒtjjƒdS(scReset server greenpool size to default and service version cache.

        :returns: None

        N(R\R›R%Rtclear_min_version_cache(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR›Ws
cCs8tj|jƒ}|dkr"dStj|ƒ}|ƒS(s$Initialize a Manager object appropriate for this service.

        Use the service name to look up a Manager subclass from the
        configuration and initialize an instance. If no class name
        is configured, just return None.

        :returns: a Manager instance, or None.

        N(RŠR€RRERRC(RSRDRV((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR¦`s

cCs|jjƒdS(sÕStart serving this service using loaded configuration.

        Also, retrieve updated port number in case '0' was passed in, which
        indicates a random port should be used.

        :returns: None

        N(R\Rq(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyRqqs	cCs|jjƒdS(s8Stop serving this API.

        :returns: None

        N(R\R(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR|scCs|jjƒdS(sPWait for the service to stop serving this API.

        :returns: None

        N(R\R’(RS((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR’„sN(RZRœRRERaR>R›R¦RqRR’(((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyRŸ.s&					cCstjtddƒS(Ntrestart_methodtmutate(RtProcessLauncherR.(((s1/usr/lib/python2.7/dist-packages/dmapi/service.pytprocess_launcherscCs=trttdƒƒ‚ntjt|ddddƒadS(Nsserve() can only be called onceR¡iR²R³(t	_launcherR:RRtlaunchR.(R\R¡((s1/usr/lib/python2.7/dist-packages/dmapi/service.pytserve—scCstjƒdS(N(R¶R’(((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyR’ scCsXtjƒ}tjƒtj|ƒ|jddddg}tjd|ƒtj	ƒt
j|ƒtrytj|ƒntj|dt
jjt
jjt
jjtƒddƒƒƒd	d
lm}xE|jƒD]7\}}|jt|ƒd|dkrdn|ƒqÓW||d
ddtd|ƒtj|dƒtj|ƒtjdƒ|S(Ns
futurist=INFOskeystoneclient=INFOsoslo_db.sqlalchemy=WARNscotyledon=INFOtdefault_log_levelstpolicy_filetapispolicy.jsoniÿÿÿÿ(RtgrouptDEFAULTR,R-tvalidate_default_valuestdefault_config_files(Rt
ConfigOptst	oslo_i18ntenable_lazytloggingtregister_optionsR¹tset_defaultsRtset_cors_middleware_defaultst
db_optionst
profiler_optstpolicy_optsR„R…tabspathRstdirnamet__file__R-Rt	list_optst
register_optstlistREtTruetsetupRRitset_transport_defaults(Rˆtconfig_filesR+t
log_levelsRR¼R((s1/usr/lib/python2.7/dist-packages/dmapi/service.pytprepare_service¤s2




(

(ARR„RtR‡RÁtoslo_messagingRitoslo_concurrencyRtoslo_configRtoslo_dbRRÇtoslo_logRRÃtoslo_policyRRÉtoslo_serviceRt
oslo_utilsRt
dmapi.confR-RRR	R
RRR
RRRt
dmapi.i18nRRRRt
try_importRÈRtosprofiler_initializert	getLoggerRZR'R+R.RŠtIntOpttOPTSR"R*R4R<RRŸRµRER¶R¸R’RÕ(((s1/usr/lib/python2.7/dist-packages/dmapi/service.pyt<module>sN@"	
			Î_