I'm having some trouble figuring out what clojure concurrency tools I
can use to solve my problem.

The application I'm trying to build is a functional test harness, like
TestNG but for clojure.  It takes an input a tree of tests to run
(where child tests don't run unless the parent passed), and runs the
tests in parallel (as much as possible) on a fixed number of threads.
Each tree node contains a promise, where the test results are placed.
A report runs at the end, and naturally blocks until all the promises
are delivered.

The problem comes where some kinds of testing require some per-thread
setup/teardown.  For instance, selenium opens a browser and drives it
to run tests.  Obviously you can't have multiple tests running in the
same browser at the same time.  So you need multiple browsers being
driven by one thread each.  Each thread has to rebind the selenium
client var to a new value.

So to sum up, I need a thread pool, and thread-local bindings so that
clients like selenium can run multithreaded.
java.util.concurrent.Executors fail because I can't get thread-local
bindings.  I haven't been able to find a way to run the entire worker
thread with a (binding ...) form, that would apparently involve
changing the implementation of the java lib, and too much of that
stuff is marked private to proxy it.

Agents seemed like a possibility (just for use as a thread pool), but
my use-case does not seem to match.  I have a single work queue, not
many.  And the agents value would have to be the local bindings, which
would never change.  And agents don't have any way of reporting if
they are busy or not, so they'd have to pull in their work rather than
having it sent to them.  My app seems like it would be a rather gross
abuse of agents.

Futures don't work because I need to limit the number of threads, I
can't have 500 browsers open at once.

Can someone suggest a direction I should go?

Thanks,

Jeff

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to