This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-27
Channels
- # announcements (8)
- # babashka (11)
- # beginners (34)
- # clerk (11)
- # clj-http (2)
- # clojure (5)
- # clojure-europe (9)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-poland (1)
- # clojure-sweden (5)
- # clojure-uk (9)
- # clojurescript (17)
- # core-typed (12)
- # cursive (4)
- # datahike (4)
- # datalevin (2)
- # datomic (7)
- # emacs (8)
- # events (8)
- # graphql (5)
- # gratitude (1)
- # hyperfiddle (19)
- # jobs-discuss (4)
- # leiningen (4)
- # lsp (21)
- # meander (2)
- # off-topic (9)
- # play-clj (1)
- # polylith (10)
- # releases (1)
- # sci (18)
- # vim (10)
@r.sevaldson viste meg en kul bruk av https://clojuredocs.org/clojure.core.async/pipeline-blocking her om dagen. Man kan putte inn hvor mye man vil at skal skje pĂ„ Ă©n gang (âconcurrencyâ), en input-kanal, en output-kanal og en transducer. Rett fram mĂ„te Ă„ utnytte flere kjerner, nĂ„r man vil ha litt mer kontroll enn med https://clojuredocs.org/clojure.core/pmap.
Eg brukte nyleg java.util.concurrent.Semaphore
for fyrste gong:
(defonce ^:private max-threads-int 16)
(defonce ^:private max-threads-semaphore (Semaphore. max-threads-int true))
;
(def ^:private wait-millis 3000)
(comment
(if (true? (.tryAcquire max-threads-semaphore wait-millis TimeUnit/MILLISECONDS))
(try
(handler ...)
(finally
(.release max-threads-semaphore)))
{:status 429 ; 429 Too Many Requests (RFC 6585)
:body {:message "Too Many Requests"}}))
For Ă„ unngĂ„ OOM pĂ„ eit endepunkt. FĂžr var det (i praksis) opptil 128 som samtidig kunne kĂžyre/polle endepunktetdin lĂžsning bruker backpressure, Ivar? Du sier bare til konsumenten âsorry, jeg kan ikke ta inn mer jobb nĂ„, kom igjen senereâ?
Hello, folks! I need to pick your đ§ on how best to write a library that depends on JAR loaded at runtime.
Namely, https://github.com/scicloj/wolframite depends on Wolframâs jlink JAR, using its classes to encode expressions and process responses. Most namespaces have at least indirect dependency on these classes and fail to load w/o the jar on the classpath.
Until now, we find and load the jar from your Wolfram installation automatically - but we want to make this heavy, side-effecting operation explicit, and replace it with an init!
fn you call yourself. However, due to the previous point, this makes it impossible to load ± any namespace.
Possible solutions:
1. Use reflection everywhere! Ugly, less error checking until you hit a code path, slower (but perhaps not meaningfully so)
2. Introduce a protocol abstracting away all jlink operations, extended to nil with a default impl. throwing exceptions, and having a global share state đ holding the real implementation after you do call init! All code currently using jlink will instead use this interface, and access it through st. like @wolframite.runtime/instance
. (Iâd try to pass it as a param instead as much as possible, but not sure how far I get with that.)
3. A better solution???
WDYT? đđđ
If it's proprietary code not distributed in a helpful way, maybe a workaround could be to create a tool that picks up the local jar, combines it with a barebones pom.xml and installs locally? clojure -T install-dat-local-shit
Thank you for giving this a thought! The contents on jar may differ based on the version of Wolfram you are using, and it indeed isnât distributed in any useful way. Having to run an extra tool sounds more troublesome than side-effecting ns load we have now.