Git Product home page Git Product logo

task's People

Contributors

amcgregor avatar dekross avatar requires avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

dekross srault95

task's Issues

Futures-compatible Executor API.

Allow scheduling of tasks for execution using the Futures API, to allow for easy drop-in migration.

  • The executor API should be class methods of the Task model.
  • Should, in the end, return Task model instances wrapped in a Futures-compatible translation object that are compatible with the built-in concurrent.futures utilities such as as_completed. See #4.

Futures-compatible Future API.

Wrap Task instances in a Future-compatible API. These are what will be returned by the Executor-compatible object when scheduling tasks.

Basic background task runner.

Utilize Futures task pooling (configurable thread or process pool) to schedule tasks for execution as they arrive. Use MongoDB atomic locking to ensure only one instance of the runner actually executes the task.

  • Initial version using a basic console_scripts entry point that when started configures logging, database connections, and Futures executor via YAML, then blocks forever waiting on new tasks.
  • New tasks should be submitted to the Futures executor (i.e. process pool or thread pool).
  • Task locking in this version following the "first to lock the task wins" approach, with graceful handling for failing that race.

Core Task API.

Construct a light-weight and elegant API for requesting local, deferred, or scheduled execution of callable objects.

  • See examples for desired interactions.
  • See these presentation slides for an overview of the process.
  • See this naive implementation for execution flow.
  • Utilize marrow.package for callable path canonicalization and resolution.
  • These should be built-in methods of the Task model.
  • Should be built with Futures-compatible wrappers in mind.
  • Provide a wrapt-based decorator suitable for optional deferring by default of functions and class methods; default is to not defer. (See examples.)
  • Task methods that check for completion/return values/exceptions should take timeout values; until MongoDB SERVER-15815 is resolved these timeouts will not be particularly accurate. This is acceptable. (No timeout = wait forever.)
  • Utilize and extend the capped collection queryset already provided.

Allow three forms of execution:

  • Immediate. I.e. calling a function or method with the default of "defer=False" from the decorator, or calling the "call" method of a "defer=True" decorated callable.
  • Deferred. I.e. calling a function or method with a "defer=True" decorated callable, or calling the "defer" method of a "defer=False" decorated callable.
  • Scheduled. I.e. calling the "at" method of decorated callable.

If the callable is a standard one (i.e. not a generator) when the function returns the value would be $set on the Task and a message emitted. If the function is a generator, $push each value to the result in the Task and send a message per yielded chunk, submitting all "completion callbacks" once for each chunk. If the callable is a generator, attempting to get the result of execution client-side would return a wrapper object (passing the timeout through) which is iterable.

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.