From 5d42acdb93faea8fafde509d01e1002a958f7a43 Mon Sep 17 00:00:00 2001 From: Anne Philipp <anne.philipp@univie.ac.at> Date: Fri, 21 Sep 2018 12:39:25 +0200 Subject: [PATCH] working version of restructured usement of pathes with config file --- _templates/job.temp | 2 +- documentation/FE_testing.txt | 13 +++++++++++++ python/ControlFile.py | 2 +- python/EcFlexpart.py | 1 + python/_config.py | 10 ++++++++-- run/control/CONTROL.test | 2 +- run/jobscripts/job.ksh | 2 +- 7 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 documentation/FE_testing.txt diff --git a/_templates/job.temp b/_templates/job.temp index e8ce376..a420316 100644 --- a/_templates/job.temp +++ b/_templates/job.temp @@ -48,7 +48,7 @@ cd $SCRATCH mkdir -p python$$ cd python$$ -export CONTROL=CONTROL +export CONTROL=$PWD/CONTROL cat >$CONTROL<<EOF EOF diff --git a/documentation/FE_testing.txt b/documentation/FE_testing.txt new file mode 100644 index 0000000..7ea1882 --- /dev/null +++ b/documentation/FE_testing.txt @@ -0,0 +1,13 @@ +Abhängigkeiten: +pytest +pytest-cov (https://pypi.org/project/pytest-cov/ ; https://pytest-cov.readthedocs.io/en/latest/) +coverage + +#Grundsätzlicher Befehl die Coverage des Testens zu überprüfen +pytest --cov=PATH_TO_PROJECT_SRC PATH_TO_TEST_SRC + +# einen test mit einem bestimmten marker nicht ausführen +pytest TestTools.py -m "not msuser_pw" + +# Tests mit einem bestimmten Marker ausführen +pytest TestTools.py -m "msuser_pw" \ No newline at end of file diff --git a/python/ControlFile.py b/python/ControlFile.py index d74c9d8..9acfd75 100644 --- a/python/ControlFile.py +++ b/python/ControlFile.py @@ -424,7 +424,7 @@ class ControlFile(object): sys.exit(1) if self.request != 0: - marsfile = os.path.join(_config.PATH_RUN_DIR, + marsfile = os.path.join(self.inputdir, _config.FILE_MARS_REQUESTS) if os.path.isfile(marsfile): os.remove(marsfile) diff --git a/python/EcFlexpart.py b/python/EcFlexpart.py index d202572..ece03dc 100644 --- a/python/EcFlexpart.py +++ b/python/EcFlexpart.py @@ -205,6 +205,7 @@ class EcFlexpart(object): self.accuracy = c.accuracy self.level = c.level self.expver = c.expver + self.levelist = c.levelist # for gaussian grid retrieval self.glevelist = '1/to/' + c.level diff --git a/python/_config.py b/python/_config.py index 7ae76a6..0270d97 100644 --- a/python/_config.py +++ b/python/_config.py @@ -76,8 +76,14 @@ PATH_RUN_DIR = os.path.join(PATH_FLEXEXTRACT_DIR, 'run') PATH_RELATIVE_RUN_DIR = os.path.relpath(PATH_RUN_DIR, PATH_FLEXEXTRACT_DIR) # path to directory where all control files are stored -PATH_CONTROLFILES = os.path.join(PATH_RUN_DIR, 'control') -PATH_RELATIVE_CONTROLFILES = os.path.relpath(PATH_CONTROLFILES, PATH_FLEXEXTRACT_DIR) +if os.getenv('CONTROL') and '/' in os.getenv('CONTROL'): + # this is only needed if remote version with job script is used! + # because job is directly submitted from SCRATCH and because the + # CONTROL file is stored there, the normal path is not valid. + PATH_CONTROLFILES = os.getenv('CONTROL') +else: + PATH_CONTROLFILES = os.path.join(PATH_RUN_DIR, 'control') + PATH_RELATIVE_CONTROLFILES = os.path.relpath(PATH_CONTROLFILES, PATH_FLEXEXTRACT_DIR) # path to directory where all job scripts are stored PATH_JOBSCRIPTS = os.path.join(PATH_RUN_DIR, 'jobscripts') diff --git a/run/control/CONTROL.test b/run/control/CONTROL.test index b693ee4..41018e1 100644 --- a/run/control/CONTROL.test +++ b/run/control/CONTROL.test @@ -15,4 +15,4 @@ RESOL 63 GAUSS 1 ADDPAR 186/187/188/235/139/39 PREFIX EItest_ -ECTRANS 1 +ECTRANS 1 \ No newline at end of file diff --git a/run/jobscripts/job.ksh b/run/jobscripts/job.ksh index 6373f11..c77cc78 100644 --- a/run/jobscripts/job.ksh +++ b/run/jobscripts/job.ksh @@ -48,7 +48,7 @@ cd $SCRATCH mkdir -p python$$ cd python$$ -export CONTROL=CONTROL +export CONTROL=$PWD/CONTROL cat >$CONTROL<<EOF accuracy 24 -- GitLab