Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to call scheduler for asynchronous execution

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

What this article shares to you is about how to call scheduler for asynchronous execution. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

RPC-API exists to quickly respond to invocation requests between process services.

The procedure for calling PRC is:

Graph LR A (api.py)-- > B (rpcapi.py) B (rpcapi.py)-- > C (manager.py)

Cinder\ cinder\ scheduler\ rpcapi.py

Class SchedulerAPI (rpc.RPCAPI): "omit code"def say_hello (self, ctxt): version= '3.0' cctxt = self.client.prepare (version=version) # cast asynchronous call, call synchronous call # through cast remote call, the request is sent back directly; remote call through call mode, you need to wait for the response to be returned from the server. Cctxt.cast (ctxt, 'say_hello')

Cinder\ cinder\ scheduler\ manager.py

Class _ SchedulerV3Proxy (object): "omit the code"def say_hello (self, context):" Demo function. Test say hello. " LOG.debug ('= manager say_hello=hello,wangyue====') # notify ceilmeter rpc.get_notifier ("volume", CONF.host) .info (context,'= scheduler say hello to you, wangyue=', None)

Call rpcapi

From cinder.scheduler import rpcapi "" omit code "" def say_hello (self, req): LOG.debug ('= say hello begin=') context = req.environ ['cinder.context'] authorize (context,' storages') rpc = rpcapi.SchedulerAPI () rpc.say_hello (context) return webob.Response (status_int=202) above is how to call scheduler for asynchronous execution The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report