4587b76fc7311e67c161d02b58d98d4e.ppt
- Количество слайдов: 28
U. S. Department of Energy Office of Science Python WS Core Joshua R. Boverhof Lawrence Berkeley National Laboratory Globus World
U. S. Department of Energy Outline Office of Science • Installation, packages and tools • Example client and service – Service specific methods – WSRF methods and Notification. Consumer • Handler Chain Architecture – WS-Security • Resource. Home. Manager – Persistence • Resource. Portal – Authorization Globus World
U. S. Department of Energy Installation Overview Office of Science Core Components %python setup. py install services security resource utility config. txt Base. Notification. Consumer. Service Secure. Conversation Subscription. Manager. Service Delegation. Service Base. Faults Resource. Properties Resource. Lifetime Exclusive. Canonicalization wsrf properties notification faults lifetime generated stubs Globus World services resource properties
U. S. Department of Energy wsdl 2 web Office of Science %wsdl 2 web. py --script=client. py --rpy=Counter. Service. rpy counter_service. wsdl server-config. tac services Resource. Tree ““wsrf/core/Subscription. Manager” --> Subscription. Manager Singleton ”/wsrf/services” -> dropins(“services”) Port Application generated counter_service Counter. Service. rpy stubs services resourceproperties . /start-container. sh 2006/08/02 22: 34 PDT [-] Log opened. 2006/08/02 22: 34 PDT [-] twistd starting up 2006/08/02 22: 34 PDT [-] reactor class:
U. S. Department of Energy client. py script Office of Science . /client. py --help usage: client. py [options] options: -h, --help show this help message and exit -u URL, --url=URL location of service -d DEBUG, --debug=DEBUG Debug Messages to file, if 1 send to stdout, if 0 then off. -w WSADDRESSURI, --ws. Address. URI=WSADDRESSURI Specify URI of ws-addressing version to use. -c CERT, --cert=CERT file path of certificate or proxy. -k KEY, --key=KEY file path of key -v M 2 SECURECONV, --m 2 secure. Conv=M 2 SECURECONV To use secure conversation, provide URL to Authorization service, and negotiate key used to sign/verify messages. -x M 2 SECUREMESSAGE, --m 2 secure. Message=M 2 SECUREMESSAGE use secure message to sign messages. -a AUTHZ, --authz=AUTHZ choose authorization, self or host. Globus World
U. S. Department of Energy Counter. Service. rpy Office of Science ################################# # Automatically generated by wsdl 2 web. py # See LBNLCopyright for copyright notice! ################################# from generated. counter_services. counter_service. Counter. Service import Counter. Service. WSRF class Service(Counter. Service. WSRF): '''override methods to do something useful''' resource = Service() Globus World
U. S. Department of Energy Service Implementation Office of Science # Counter. Service. py from py. Grid. Ware. addressing. Addressing. Utils import Addressing. Utils from generated. counter_services. counter_service. Counter. Service import Counter. Service. WSRF as WSRFService class Service(WSRFService): def wsa_add(self, ps, address, **kw): request, response = WSRFService. wsa_add(self, ps, address, **kw) ctx = WSRFService. Get. Resource. Context(ps, address, **kw) ctx. properties. Value += request return request, response. __class__(ctx. properties. Value) def wsa_create. Counter(self, ps, address, **kw): request, response = WSRFService. wsa_create. Counter(self, ps, address, **kw) ctx = WSRFService. New. Resource. Context. Counter. Port. Type. Port(**kw) ctx. properties. Value = 0 response. Endpoint. Reference = Addressing. Utils. create. Endpoint. Reference(ctx) return request, response Globus World
U. S. Department of Energy Example Service Office of Science # Counter. Service. rpy import Counter. Service resource = Counter. Service() Globus World
U. S. Department of Energy Flowchart: SOAP In/out Office of Science Core generated security ps addr resource WSResource Handler. Chain service stubs request response services HTTPRequest resource Twisted. web properties Client Globus World
U. S. Department of Energy Client: Create & Destroy Office of Science from generated. counter_service. stubs import counter_service as CLIENT def main(**kw): locator = CLIENT. Counter. Service. Locator() port = locator. get. Counter. Port. Type(**kw) response = port. create(CLIENT. Create. Request()) iport = locator. get. Counter. Port. Type( end. Point. Reference=response. Endpoint. Reference, **kw) iport. destroy(CLIENT. Destroy. Request()) Globus World
U. S. Department of Energy Flowchart: Create Office of Science New. Resource. Context. Counter. Port. Type. Port generated HTTPRequest wsrf stubs notification service ctx services faults properties resource manager properties Globus World lifetime
U. S. Department of Energy Flowchart: Destroy Office of Science Immediate. Resource. Termination. Destroy(ctx, **kw) generated Get. Resource. Context stubs Destroy services ctx wsrf ctx notification faults addr resource manager properties Globus World properties Immediate lifetime
U. S. Department of Energy Client: Subscribe Office of Science from py. Grid. Ware. wsrf. notification. Notification. Consumer import * from py. Grid. Ware. wsrf. notification import Subscribe. Utility from generated. counter_service. stubs import counter_service as COUNTER def main(**kw): consumer = Notification. Consumer() consumer. start() locator = COUNTER. Counter. Service. Locator() port = locator. get. Counter. Port. Type(**kw) response = port. create. Counter(COUNTER. Create. Counter. Request()) epr = response. Endpoint. Reference iport = locator. get. Counter. Port. Type(end. Point. Reference=epr, **kw) request = COUNTER. Subscribe. Request() Subscribe. Utility. Simple. Topic. Expression(request, consumer, "http: //counter. com", "Value”) response = iport. Subscribe(request) Globus World
U. S. Department of Energy Flowchart: Subscribe Office of Science Subscription Manager: create subscription & reference generated stubs request context manager notification services epr resource properties Globus World wsrf faults properties lifetime
U. S. Department of Energy Handler. Chain Office of Science Core security resource WSResource Handler. Chain addr soap service request response HTTPRequest HTTPResponse Twisted. web Client Globus World
U. S. Department of Energy WSResource render Office of Science Single handler chain shared on a request/response flow. def render_POST(self, request): chain = self. factory. new. Instance() data = request. content. read() try: pyobj = chain. process. Request(data, request=request, resource=self) except Exception, ex: return self. _write. Fault(request, ex) try: soap = chain. process. Response(pyobj, request=request, resource=self) except Exception, ex: return self. _write. Fault(request, ex) if soap is not None: return self. _write. Response(request, soap) Globus World
U. S. Department of Energy process. Request Office of Science factory = Handler. Chain. Factory WSResource str ps - Parsed. Soap Handler. Chain Client Data. Handler chain instance ps WSAddr ps ps Callback Globus World Service method
U. S. Department of Energy process. Response Office of Science factory = Handler. Chain. Factory WSResource Client request - pyobj response - pyobj sw - Soap. Writer Handler. Chain Data. Handler str sw WSAddr Callback Globus World response request response Service
U. S. Department of Energy Example WS-Security Office of Science # Secure. Counter. Service-auth. Service. rpy from py. Grid. Ware. services import Secure. Conversation. Service resource = Secure. Conversation. Service() # Secure. Counter. Service. rpy import Counter. Service from py. Grid. Ware. security. gss. resource import WSSecurity. Handler. Chain. Factory resource = Counter. Service() resource. factory = WSSecurity. Handler. Chain. Factory Globus World
U. S. Department of Energy Office of Science WSSecurity: verify factory = WSSecurity. Handler. Chain. Factory WSResource Handler. Chain Data. Handler Client str ps - Parsed. Soap Handler chain instance ps WSAddr Verify signatures ps WSSecurity. Handler GSISignature. Handler ps Callback Globus World ps Service method
U. S. Department of Energy Office of Science WSSecurity: sign factory = WSSecurity. Handler. Chain. Factory request - pyobj response - pyobj sw - Soap. Writer WSResource Handler. Chain Client Data. Handler sw str WSAddr sw response add signatures WSSecurity. Handler GSISignature. Handler Callback Globus World request, response Service method
U. S. Department of Energy Resource. Home. Manager 1 Office of Science Context. home = Manager. Home. get. Instance(Simple. Resource. Home) Core security resource Manager Resource. Home Simple. RH Persistent. RH generated service stubs Twisted. web services Manager -- Simple. RH utility properties Globus World Client 1 Client 2 Manager is configured with a implementation of IResource. Home
U. S. Department of Energy Resource. Home. Manager 2 Office of Science Create --> New. Resource. Context Core security resource Manager Resource. Home Simple. RH Persistent. RH generated stubs services Manager -- Simple. RH home ctx 1 utility properties Globus World Unprotected service will use a single resource home, “Anonymous”
U. S. Department of Energy Example Authorization Office of Science # Counter. Service. rpy import Counter. Service from py. Grid. Ware. security. authz. resource import Resource. Portal from py. Grid. Ware. security. authz. checkers import Grid. Map. Checker resource = Resource. Portal(Counter. Service(), checkers=[Grid. Map. Checker()], callback=None) Globus World
U. S. Department of Energy Resource. Portal: setup Office of Science Resource. Portal(Service(), checkers=[Grid. Map. Checker()], callback=None) boverh of krjackson Twisted. web Site /wsrf/services/Counter. Service Resource. Portal Realm service Checker Globus World
U. S. Department of Energy Portal: Service Login Office of Science Service Level Authorization Resource. Portal render Realm request. Avatar cred service IResource cred Portal login Grid. Map. Checker request. Avatar. Id avatar. Id (boverhof) Globus World service
U. S. Department of Energy Portal: Service Instance Office of Science Service Instance Level Authorization Resource. Portal render Resource. Home. Manager Service render request ctx 1 boverhof ctx 1 cred IResource. Home krjackson ctx 2 ctx 3 boverhof Portal login Globus World
U. S. Department of Energy Conclusions Office of Science • Use the wsdl 2 web tool to create a Site • Service specific functionality must be implemented • Configuration files are python scripts • The Python Grid Service work is funded by the U. S. Department of Energy Office of Science Globus World


