about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-15 12:03:19 -0500
committerFrederick Muriuki Muriithi2024-09-10 09:47:09 -0500
commitf177fd8e727e9814ecb9dfd9f9d0909e08f42d92 (patch)
tree4f39616b1194b7f476f7695960a9b259ac11b46b
parent0ba26de033a674b5269bbeb41bae441a565a22b1 (diff)
downloadgn-machines-f177fd8e727e9814ecb9dfd9f9d0909e08f42d92.tar.gz
Run script to make non-human data public
-rw-r--r--genenetwork/services/genenetwork.scm34
1 files changed, 33 insertions, 1 deletions
diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm
index 34d70df..9808ce5 100644
--- a/genenetwork/services/genenetwork.scm
+++ b/genenetwork/services/genenetwork.scm
@@ -212,6 +212,33 @@
                             (chmod file #o644))
                           (find-files #$xapian-directory)))))))))
 
+(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)
@@ -475,7 +502,12 @@ a @code{<genenetwork-configuration>} record."
   (list #~(job '(next-hour)
                #$(program-file "build-xapian-index-cron-gexp"
                                (build-xapian-index-cron-gexp config))
-               #:user "root")))
+               #:user "root")
+        #~(job '(next-hour)
+               #$(program-file "make-non-human-data-public-cron-gexp"
+                               (make-non-human-data-public-cron-gexp config))
+               #:user "gunicorn-gn-auth")
+        ))
 
 (define genenetwork-service-type
   (service-type