This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-16
Channels
- # announcements (2)
- # beginners (25)
- # calva (50)
- # cider (33)
- # clj-kondo (46)
- # cljs-dev (5)
- # cljsrn (23)
- # clojure (34)
- # clojure-dev (5)
- # clojure-russia (2)
- # clojure-spec (29)
- # clojurescript (11)
- # datomic (3)
- # docker (2)
- # duct (1)
- # emacs (11)
- # fulcro (15)
- # jobs-discuss (47)
- # off-topic (11)
- # om (2)
- # pathom (6)
- # re-frame (9)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (105)
- # spacemacs (4)
- # tools-deps (6)
- # xtdb (4)
i have a computational and memory heavy function that needs to be applied to a different sets of data (read file, run algorithm, collect results). In some cases the algorithm might take to long or use too much memory. My plan right now is too use core async because i assume it will let me isolate each pipeline to its own thread and because it will let me timeout any processes that are running too long (1 minute is probably enough to signify it will never complete).
Does this sound reasonable?
Is there a way to set limits on how much memory the thread can use up or monitor it?
I assume it makes more sense to use the blocking variant via thread
rather then a the go block parking version because these last longer, deal with file io, etc...
The JVM has the ability to set the max heap to use for the entire process, but I am not aware of any mechanisms for setting the max heap per thread.
If the work done in a single thread is long enough that starting up a separate JVM for each one is reasonably small time overhead, you could do that for setting the max memory.
is there a testing framework that does clojure and clojurescript, is compatible with the tooling for clojure.test and allows for singling out a test to run very easily ?
I use clojure.test + custom emacs functions (which in any case use vanilla techniques)
for clj, I programatically call the deftest via its var metadata : (-> #'some-test meta :name .call)
.
Using the :name
enables support of a few other frameworks, which don't have a 1:1 mapping between the test-defining forms, and the invokable functions that they generate
for cljs, I eval the following:
(concat "(.reload js/location true) "
"(cljs.test/run-block ["
(cider-symbol-at-point)
"])")
If interested you can grep this-deftest
in https://github.com/zenmacs/.emacs.d/blob/master/lib/non-submodules/vemv.clojure-interaction.el but I don't expect ppl to understand/use my emacs 🙂@carkh If I want to run a single test, I do it via the REPL with clojure.test/test-vars
Most of the time I run tests via the REPL anyway...
The test runners I've used can narrow to a single namespace but not a single test function I think. Some of them let you put metadata on tests and then filter on that metadata -- so that would let you run a single test I guess.
What's you use case? Why do you want to run an individual test?
i'm usually not so hot on testing, but i think it very usefull for data structure and algorithmic work
I am pretty big on testing. Of our 87,000 lines of Clojure, about 20k are tests.
While I run full test suites from the command line and occasionally just one namespace, I mostly run tests from my editor via the REPL -- just a hot key to run all tests in the current namespace, or to run the single test under the cursor.
True, cljs complicates nearly everything 🙂
in javascript land there is this neat testing tool where you just change a letter in your test, and now it will only run this one
shadow-cljs has the :ns-regexp
build option that let's you narrow down the top-level built ns's). I usually paste the target ns there while working - shadow picks that up without restarting.
the eheart of the problem is that when debugging i'm littering the code with logging statements
so the ideal workflow to me would be : mark the test (via ui or code), add a logging statement, save the file, test is run, check the result and move on with more logging without returning to the test namespace