Skip to content

Commit

Permalink
Apply fix for Jena bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tnavatar committed Aug 15, 2024
1 parent 6c4c0fb commit c879960
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/genegraph/gene_validity.clj
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,18 @@
(defn gv-ready-fn [e]
(let [tdb (get-in e [::storage/storage :gv-tdb])
type-count (fn [t]
(count (type-query tdb {:type t})))]
(rdf/tx tdb
(count (type-query tdb {:type t})))
in-tx (.isInTransaction tdb)]
(try
(when-not in-tx
(.begin tdb ReadWrite/READ))
(let [gv-count (type-count
:sepio/GeneValidityEvidenceLevelAssertion)
ac-count (type-count :sepio/ActionabilityReport)
gd-count (type-count :sepio/GeneDosageReport)]
(log/info :fn ::gv-ready-fn
(.commit tdb) ; https://github.com/apache/jena/issues/2584
(.end tdb)
#_(log/info :fn ::gv-ready-fn
:gv-count gv-count
:ac-count ac-count
:gd-count gd-count)
Expand Down
2 changes: 1 addition & 1 deletion src/genegraph/notebooks.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(assoc gv/gv-tdb
:snapshot-handle {:type :file
:base "/Users/tristan/code/genegraph-gene-validity/data/"
:path "gv-tdb-v11.nq.gz"})}})
:path "gv-tdb-v12.nq.gz"})}})


(comment
Expand Down
44 changes: 43 additions & 1 deletion src/genegraph/user.clj
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,32 @@
(def gv-test-app (p/init gv-test-app-def))
(p/start gv-test-app)
(p/stop gv-test-app)

(time
(let [c (hc/build-http-client {})
lock (Semaphore. 10)]
(dotimes [n 10000]
(.acquire lock)
(Thread/startVirtualThread
(fn []
(hc/get "http://localhost:8888/ready")
(.release lock))))))

(time
(let [c (hc/build-http-client {})
lock (Semaphore. 10)
db @(get-in gv-test-app [:storage :gv-tdb :instance])]
(dotimes [n 100000]
(.acquire lock)
(Thread/startVirtualThread
(fn []
(try
(let [db @(get-in gv-test-app [:storage :gv-tdb :instance])]
(gv/gv-ready-fn {::storage/storage {:gv-tdb db}}))
(finally (.release lock))))))))

(let [db @(get-in gv-test-app [:storage :gv-tdb :instance])]
(gv/gv-ready-fn {::storage/storage {:gv-tdb db}}))
)

;; Downloading events
Expand Down Expand Up @@ -1299,10 +1324,27 @@ select ?x where {
::event/skip-local-effects true
::event/skip-publish-effects true)))


(let [tdb @(get-in gv-test-app [:storage :gv-tdb :instance])]
(rdf/tx tdb
(let [r (rdf/resource "CGGV:fe942eb4-ba59-43bf-89e0-243522ba7cbf"
tdb)]
(rdf/pp-model (storage/read tdb (str r))))))


(-> dnase1
last
process-gv-event
process-gv-event
:gene-validity/model
rdf/pp-model)
)


(comment
(time
(let [tdb @(get-in gv-test-app [:storage :gv-tdb :instance])]
(dotimes [n 100000]
(rdf/tx tdb
(+ 1 1)))))

)

0 comments on commit c879960

Please sign in to comment.