Code Monkey home page Code Monkey logo

dispatch's Introduction

Entities: cfg: Configuration from yaml Task Manager: exposes task decorator and maintains global list of tasks Task: A task that can be dispatched. The decorated function AsyncInvocation: An instance of calling a task AsyncResult: The future for retrieving a task result

@task decorator enrolls the method into task_manager._ALL_TASKS task.dispatch() -> create Message -> publisher.publish() -> SQS consumer.message_handler() -> create Message from JSON data -> task_manager.find_task_by_name() -> task.call(message) -> calls task function

TODO: Fix testing for queue create/delete 60s time issue

TODO: dead-letter queue config

TODO: more graceful handling of reply_to queue being deleted before worker procs

TODO: Message -> RequestMessage

TODO: Worker initialization (db, caching, etc..)

Questions: How is the connection to SQS managed? Persistent? does Session() return the same connection each call?

Worker:

Pool of N workers One fetcher process per SQS queue we are reading from The fetcher processes enqueue (multiprocessing.Queue) the Message for a worker to get() The worker calls the task in the Message The worker deletes the message from the queue

reply_to: each task has it's own reply_to RequestMessage and ResponseMessage are separate entities Each publisher registers a reply queue per task

  • Make sure publishers delete reply_to queues when exiting

dispatch's People

Contributors

shanehead avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.