aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr Prins2023-11-14 17:53:05 +0100
committerPjotr Prins2023-11-14 17:53:05 +0100
commit12e43794a12a94e45c25cadf5d167697c16c4f5f (patch)
treef761dab8235a7cff9a98f4d865316e14ac46cc13 /scripts
parent0e29ab17e14d1d58905ae708ac48acb0e47cbd86 (diff)
downloadgn-guile-12e43794a12a94e45c25cadf5d167697c16c4f5f.tar.gz
Started on precompute script
Diffstat (limited to 'scripts')
-rw-r--r--scripts/precompute/.guix-shell10
-rw-r--r--scripts/precompute/README.md4
-rwxr-xr-xscripts/precompute/precompute-hits.scm20
3 files changed, 24 insertions, 10 deletions
diff --git a/scripts/precompute/.guix-shell b/scripts/precompute/.guix-shell
deleted file mode 100644
index 08c74f9..0000000
--- a/scripts/precompute/.guix-shell
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-#
-# run with options '-- ./webserver.scm 8091' e.g.
-# . .guix-shell -- guile -L .. --fresh-auto-compile --listen=1970 -e main ./webserver.scm 8091
-
-echo "Create a shell to run tools. In the container"
-echo "mkdir /usr/bin -p"
-echo "ln -s \$GUIX_ENVIRONMENT/bin/env /usr/bin/env"
-
-guix shell -C -F --network coreutils guile guile-dbi guile-dbd-mysql guile-fibers guile-json guile-gnutls guile-readline guile-redis openssl nss-certs $*
diff --git a/scripts/precompute/README.md b/scripts/precompute/README.md
index 53f846e..c1f2efc 100644
--- a/scripts/precompute/README.md
+++ b/scripts/precompute/README.md
@@ -1,3 +1,7 @@
# Precompute
Some work on precompute is documented [here](https://issues.genenetwork.org/topics/systems/mariadb/precompute-mapping-input-data). This is WIP.
+
+# Install and run
+
+See the header of [precompute-hits.scm](precompute-hits.scm).
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
new file mode 100755
index 0000000..7986f6a
--- /dev/null
+++ b/scripts/precompute/precompute-hits.scm
@@ -0,0 +1,20 @@
+#! Run from base dir with
+
+. .guix-shell -- guile -L . -s ./scripts/precompute/precompute-hits.scm
+
+!#
+
+(use-modules (dbi dbi)
+ (gn db mysql)
+ )
+
+;; potentially you want to test connection with mysql client:
+;;
+;; mysql -uwebqtlout -pwebqtlout -A -h 127.0.0.1 -P 3306
+;;
+(define db_webqtl (dbi-open "mysql" "webqtlout:webqtlout:db_webqtl:tcp:127.0.0.1:3306"))
+(dbi-query db_webqtl "SELECT * FROM ProbeSetXRef LIMIT 3")
+(display (dbi-get_status db_webqtl))
+(let [(row (dbi-get_row db_webqtl))]
+ (display row)
+)