about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-15 12:03:19 -0500
committerFrederick Muriuki Muriithi2025-10-07 09:37:43 -0500
commit2141c00a9fb850549fbccb0ef6c3693193e8c7dc (patch)
tree399bd67e453f41c27db34469d40b90a3095675c9
parentaf6779de931c397de42f21575b35989401487ae5 (diff)
downloadgn-machines-production-container.tar.gz
Run script to make non-human data public production-container
-rw-r--r--genenetwork/services/genenetwork.scm33
1 files changed, 32 insertions, 1 deletions
diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm
index 99e78b9..93a8bf3 100644
--- a/genenetwork/services/genenetwork.scm
+++ b/genenetwork/services/genenetwork.scm
@@ -285,6 +285,33 @@
                   "gn2.scripts.sample_count"
                   #$sql-uri)))))
 
+(define (make-non-human-data-public-cron-gexp config)
+  (match-record config <genenetwork-configuration>
+    (gn-auth sql-uri auth-db)
+    (with-imported-modules '((guix build utils))
+      #~(begin
+          (use-modules (guix build utils))
+
+          (setenv "PYTHONPATH"
+                  (string-append
+                   #$(file-append gn-auth
+                                  "/lib/python"
+                                  (python-version (package-version python))
+                                  "/site-packages")
+                   ":"
+                   #$(profile
+                        (content (package->development-manifest gn-auth))
+                        (allow-collisions? #t))
+                   "/lib/python"
+                   #$(python-version (package-version python))
+                   "/site-packages"))
+
+          (invoke #$(file-append python "/bin/python3")
+                  "-m"
+                  "scripts.batch_assign_data_to_default_admin"
+                  #$auth-db
+                  #$sql-uri)))))
+
 (define (genenetwork-activation config)
   (match-record config <genenetwork-configuration>
     (gn2-secrets gn3-secrets gn-auth-secrets auth-db llm-db-path genotype-files gn-tmpdir gn-doc-git-checkout gn2-sessions-dir)
@@ -650,7 +677,11 @@ a @code{<genenetwork-configuration>} record."
                #:user "root")
         #~(job '(next-minute-from (next-hour) '(17)) ;17th minute of every hour
                #$(program-file "samples-count-script-gexp"
-                               (samples-count-script-gexp config)))))
+                               (samples-count-script-gexp config)))
+        #~(job '(next-minute (range 0 60 15))
+               #$(program-file "make-non-human-data-public-cron-gexp"
+                               (make-non-human-data-public-cron-gexp config))
+               #:user "gunicorn-gn-auth")))
 
 (define (gn-guile-gexp gn-guile-port gn-guile-pkg)
   (with-imported-modules '((guix build utils))