AnyEvent::Task

Client/server-based asynchronous worker pool
Download

AnyEvent::Task Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Doug Hoyte
  • Publisher web site:
  • http://www.hcsw.org

AnyEvent::Task Tags


AnyEvent::Task Description

AnyEvent::Task is a fork-on-demand but persistent-worker server (AnyEvent::Task::Server) combined with an asynchronous interface to a request queue and pooled-worker client (AnyEvent::Task::Client). Both client and server are of course built with AnyEvent because it's awesome. However, workers can't use AnyEvent (yet).A server is started with AnyEvent::Task::Server->new. This should at least be passed the listen and interface arguments. Keep the returned server object around for as long as you want the server to be running. interface is the code that should handle each request. See the interface section below for its specification. A setup coderef can be passed in to run some code when a new worker is forked. A checkout_done coderef can be passed in to run some code whenever a checkout is released (see below).A client is started with AnyEvent::Task::Client->new. You only need to pass connect to this. Keep the returned client object around as long as you wish the client to be connected.After both the server and client are initialised, each process must enter AnyEvent's "main loop" in some way, possibly just AE::cv->recv.In the client process, you may call the checkout method on the client object. This checkout object can be used to run code on a remote worker process in a non-blocking manner. The checkout method doesn't require any arguments, but timeout is recommended.You can treat a checkout object as an object that proxies its method calls to a worker process or a function that does the same. You pass the arguments to these method calls as an argument to the checkout object, followed by a callback as the last argument. This callback will be called once the worker process has returned the results. This callback will normally be passed two arguments, the checkout object and the return value. In the event of an exception thrown inside the worker, only the checkout object will be passed in and $@ will be set to the error message.Product's homepage


AnyEvent::Task Related Software