From e922eb1c9519e41182628bc3f94ba0d1dcbedc12 Mon Sep 17 00:00:00 2001
From: Felix Kleinert <f.kleinert@fz-juelich.de>
Date: Tue, 7 Apr 2020 20:06:19 +0200
Subject: [PATCH] move PartitionCheck to own module

---
 run.py                              |  3 ++-
 src/run_modules/experiment_setup.py | 15 ---------------
 src/run_modules/partition_check.py  | 23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/run.py b/run.py
index 0efb0e4d..78c18d1b 100644
--- a/run.py
+++ b/run.py
@@ -4,7 +4,8 @@ __date__ = '2019-11-14'
 
 import argparse
 
-from src.run_modules.experiment_setup import ExperimentSetup, PartitionCheck
+from src.run_modules.experiment_setup import ExperimentSetup
+from src.run_modules.partition_check import PartitionCheck
 from src.run_modules.model_setup import ModelSetup
 from src.run_modules.post_processing import PostProcessing
 from src.run_modules.pre_processing import PreProcessing
diff --git a/src/run_modules/experiment_setup.py b/src/run_modules/experiment_setup.py
index 45778074..ac6806eb 100644
--- a/src/run_modules/experiment_setup.py
+++ b/src/run_modules/experiment_setup.py
@@ -187,21 +187,6 @@ class ExperimentSetup(RunEnvironment):
             self._set_param("statistics_per_var", stat_new)
 
 
-class PartitionCheck(RunEnvironment):
-
-    """ Checking if running on a HPC login node. The onöy reason to run on login nodes is to download data. Training and validation should happen on compute nodes"""
-
-    def __init__(self):
-        # create run framework
-        super().__init__()
-
-        self._run()
-
-    def _run(self):
-        if self.data_store.get('hostname')[:2] in self.data_store.get('login_nodes'):
-            raise OSError('You are on a login node to download data. Use compute nodes and run again if you want to train and validate a model.')
-
-
 if __name__ == "__main__":
 
     formatter = '%(asctime)s - %(levelname)s: %(message)s  [%(filename)s:%(funcName)s:%(lineno)s]'
diff --git a/src/run_modules/partition_check.py b/src/run_modules/partition_check.py
index e69de29b..ee4edf05 100644
--- a/src/run_modules/partition_check.py
+++ b/src/run_modules/partition_check.py
@@ -0,0 +1,23 @@
+__author__ = "Felix Kleinert"
+__date__ = '2020-04-07'
+
+from src.run_modules.run_environment import RunEnvironment
+
+
+class PartitionCheck(RunEnvironment):
+    """
+    Checking if running on a HPC login node. The only reason to run on login nodes is to download data.
+    Training and validation should happen on compute nodes
+    """
+
+    def __init__(self):
+        # create run framework
+        super().__init__()
+
+        self._run()
+
+    def _run(self):
+        if self.data_store.get('hostname')[:2] in self.data_store.get('login_nodes'):
+            raise OSError(
+                'You are on a login node to download data. Use compute nodes and run again if '
+                'you want to train and validate a model.')
-- 
GitLab