about summary refs log tree commit diff
path: root/genenetwork
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-10-08 09:09:55 -0500
committerFrederick Muriuki Muriithi2025-10-27 08:53:35 -0500
commitb6fdc15da820e207637014ef4c5d2be5b6ce955b (patch)
treef61d3a236cde8ef06fcfd28b4c6c984f925f6d9a /genenetwork
parent7729980ad1242be5d4f82d023891bc6af4824794 (diff)
downloadgn-machines-production-container.tar.gz
Run script to make non-human data public production-container
Diffstat (limited to 'genenetwork')
-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 9ba6213..b662005 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 bare-repo)
   (with-imported-modules '((guix build utils))