kschiess / procrastinate Goto Github PK
View Code? Open in Web Editor NEWFramework to run tasks in separate processes.
Home Page: http://blog.absurd.li/2010/12/23/procrastinate_away.html
License: MIT License
Framework to run tasks in separate processes.
Home Page: http://blog.absurd.li/2010/12/23/procrastinate_away.html
License: MIT License
INTRO 'procrastinate' does the process handling so you don't have to. It leaves you to concentrate on what to run when, not orchestration of low level details. This library will be ideal for quickly scheduling of a lot of long running tasks. You can easily control how many processes are run at any time. Your main thread can continue to do useful work until it accesses the results of the computation, at which point it will wait for the processes to finish. SYNOPSIS require 'procrastinate/implicit' class Worker def do_work puts "> Starting work in process #{Process.pid}" sleep 2 puts "< Work completed in process #{Process.pid}" end end worker = Procrastinate.proxy(Worker.new) 10.times do worker.do_work end Procrastinate.join The above example will output something like > Starting work in process 56144 > Starting work in process 56145 > Starting work in process 56146 > Starting work in process 56147 > Starting work in process 56148 > Starting work in process 56149 < Work completed in process 56144 < Work completed in process 56145 < Work completed in process 56146 < Work completed in process 56147 < Work completed in process 56148 < Work completed in process 56149 > Starting work in process 56150 > Starting work in process 56151 > Starting work in process 56152 > Starting work in process 56153 < Work completed in process 56150 < Work completed in process 56151 < Work completed in process 56152 < Work completed in process 56153 (The output depends on the number of cores your machine has) COMPATIBILITY This library runs with MRI Ruby >= 1.9. Ruby 1.9-p136 users must use this patch: https://gist.github.com/762807 As a general remark: Interaction with Ruby versions is significant. Please use the latest version available to you, since fork & threading bugs are likely to be fixed there. KNOWN BUGS Due to the way we handle signal traps, you cannot start more than one Scheduler. We might allow that in the future. Also: signal traps interact with other libraries and might cause things to break. This is the real world. STATUS We're still adding features that we believe must be in 1.0. What is there mostly works; Multi-{Processing, Threading} is always a difficult topic and we're glad to receive bug reports. Please see the LICENSE file for license information. (c) 2010 Kaspar Schiess, Patrick Marchi
@floere just discovered the following race-condition:
The bug is most likely in Scheduler#spawn, where the task is removed from the task_producer queue but not yet created as a process.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.