From dce18d219d757c69fee0f6d6a2f5edcb9504b175 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org>
Date: Tue, 23 Nov 2021 17:38:32 +0100
Subject: [PATCH] WIP docs

---
 integrationtests/create_analysis.py | 16 ++++++----------
 integrationtests/test.sh            |  2 ++
 integrationtests/update_analysis.py |  7 ++++++-
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/integrationtests/create_analysis.py b/integrationtests/create_analysis.py
index 44e99c98..40abc072 100644
--- a/integrationtests/create_analysis.py
+++ b/integrationtests/create_analysis.py
@@ -24,26 +24,23 @@
 #
 
 """
-module description
+A small script that creates an Analysis Record that can be used for testing the
+automated analysis pipeline.
 """
 
 import sys
+from datetime import datetime
 
 import caosdb as db
 
 
 def main():
-    # TODO remove fixed path
     script = db.File(
         file="../src/caosadvancedtools/serverside/examples/example_script.py",
-        path="Analysis/scripts/example_script.py",
+        path=("AutomatedAnalysis/scripts/"
+              + str(datetime.now())+"example_script.py"),
     )
-    try:
-        script.insert()
-    except:
-        script = db.execute_query(
-                        "FIND FILE which is stored at 'Analysis/scripts/example_script.py'",
-                        unique=True)
+    script.insert()
 
     da = db.Record()
     da.add_parent("Analysis")
@@ -52,7 +49,6 @@ def main():
                     value=db.execute_query(
                         "FIND FILE which is stored at '**/timeseries.npy'",
                         unique=True),
-                    # datatype=db.LIST(db.FILE)
                     )
     da.add_property("date", "2020-01-01")
     da.add_property("identifier", "TEST")
diff --git a/integrationtests/test.sh b/integrationtests/test.sh
index 9cf17be4..1c0357e2 100755
--- a/integrationtests/test.sh
+++ b/integrationtests/test.sh
@@ -67,6 +67,8 @@ echo "Testing im and export"
 python3 test_im_und_export.py
 
 # automated analysis
+# for some reason the loadFiles of sim data has to be called again
+python3 -m caosadvancedtools.loadFiles /opt/caosdb/mnt/extroot/SimulationData
 python3 create_analysis.py
 
 # Better safe than sorry:
diff --git a/integrationtests/update_analysis.py b/integrationtests/update_analysis.py
index 3fd9840a..9c2adf5f 100644
--- a/integrationtests/update_analysis.py
+++ b/integrationtests/update_analysis.py
@@ -24,7 +24,12 @@
 #
 
 """
-module description
+Exemplary update script. An anlysis Record is retrieved and passed to the
+generic run function which then calls the appropriate script based on the
+Record.
+
+The simple query here could be replaced with something that e.g. retrieves all
+entities that where changed within a certain period of time.
 """
 
 import sys
-- 
GitLab