Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rails app to run distributed tasks

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 doc
Octocat-spinner-32 lib
Octocat-spinner-32 log
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 test
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 Rakefile


Distributes tasks to multiple browsers

Inspired by projects like folding@home and SETI@home, this is a framework on top of Rails that allows the server to distribute tasks to its clients (browsers). This is best suited for highly parallelizeable tasks such as monte-carlo simulations or other embarassingly parallel problems.


  • Provide tasks.js files in app/tasks
  • task*.js must define var nextTask = new Task(main_function_name)
  • The result of main_function_name will be saved in the db


Already completed tasks will run again on a new machine and the results will be compared (about 10% of the time). This gives some additional confidence in the results, but is by no means a security guarantee.

Some tasks (e.g. random generations) are not well suited for verification. For these tasks, the rake tasksjs:repeated command takes an additional argument to omit verification.


A Rakefile has been provided to make some common tasks easier. The namespace is tasksjs.

Note: For rake operations that add tasks to the database, rake will also look for a parameters file parameters_task*.txt in the same location, and will use parameters on a single line. See more at parameters

  • rake tasksjs:init will clear all tasks from the database, then go through all the tasks in app/tasks and add them to the database
  • rake tasksjs:repeated will take an argument num and add all the tasks in app/tasks num times.
  • as noted above rake tasksjs:repeated will take an additional argument to disable verification. If you want verification to be disabled, you should pass "true".


The parameters_task*.txt file is expected to have all the needed comma separated parameters on one line. This will then be applied to the function in task*.txt, once for every line.

A parameters_task*.txt like the following:

0, "james", "sally"
5, "john", "jerry"

will result in two tasks being added to the queue:

  • task*.js with args 0, "james", "sally"
  • task*.js with args 5, "john", "jerry"


An examples folder has been provided in app/tasks. These simple examples can be moved into app/tasks if you'd like to use them. Some have parameters, others need to have verification disabled (monte carlo).

Initial Goals

  • browsers execute arbitrary tasks and return results to browser
  • server manages queue from db
  • things are added to queue only by the server (clients adding tasks is a non-goal for now)
Something went wrong with that request. Please try again.