From 1aa97e17b171822121aef6775851ab12a40a064e Mon Sep 17 00:00:00 2001
From: Felix Kleinert <f.kleinert@fz-juelich.de>
Date: Mon, 6 Apr 2020 18:28:22 +0200
Subject: [PATCH] include check for JUWELS compute and login nodes

---
 requirements_JUWELS_outcommented.txt | 2 +-
 src/helpers.py                       | 6 ++++--
 src/run_modules/experiment_setup.py  | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/requirements_JUWELS_outcommented.txt b/requirements_JUWELS_outcommented.txt
index 2432b057..821dd802 100644
--- a/requirements_JUWELS_outcommented.txt
+++ b/requirements_JUWELS_outcommented.txt
@@ -22,7 +22,7 @@ importlib-metadata==1.5.0
 # kiwisolver==1.1.0              # in SciPy-Stack
 # locket==0.2.0                  # in Jupyter
 # Markdown==3.2.1                # in TF 
-# matplotlib==3.2.0              # in SciPy-Stack 
+matplotlib==3.2.0              # in SciPy-Stack 
 # mock==4.0.1                    # in Python 
 # more-itertools==8.2.0          # in Python 
 # numpy==1.18.1                  # in SciPy-Stack
diff --git a/src/helpers.py b/src/helpers.py
index a1c50858..3ea9d618 100644
--- a/src/helpers.py
+++ b/src/helpers.py
@@ -8,6 +8,7 @@ import datetime as dt
 import logging
 import math
 import os
+import getpass
 import socket
 import sys
 import time
@@ -104,7 +105,8 @@ def get_host():
 def prepare_host(create_new=True, sampling="daily"):
     hostname = socket.gethostname()
     try:
-        user = os.getlogin()
+        # user = os.getlogin()
+        user = getpass.getuser()
     except OSError:
         user = "default"
     if hostname == "ZAM144":
@@ -115,7 +117,7 @@ def prepare_host(create_new=True, sampling="daily"):
         path = f"/home/{user}/machinelearningtools/data/toar_{sampling}/"
     elif (len(hostname) > 2) and (hostname[:2] == "jr"):
         path = f"/p/project/cjjsc42/{user}/DATA/toar_{sampling}/"
-    elif (len(hostname) > 2) and (hostname[:2] == "jw"):
+    elif (len(hostname) > 2) and (hostname[:2] in ['jw', 'ju']):
         path = f"/p/home/jusers/{user}/juwels/intelliaq/DATA/toar_{sampling}/"
     elif "runner-6HmDp9Qd-project-2411-concurrent" in hostname:
         path = f"/home/{user}/machinelearningtools/data/toar_{sampling}/"
diff --git a/src/run_modules/experiment_setup.py b/src/run_modules/experiment_setup.py
index 71f21c7f..70e75e22 100644
--- a/src/run_modules/experiment_setup.py
+++ b/src/run_modules/experiment_setup.py
@@ -24,7 +24,7 @@ DEFAULT_VAR_ALL_DICT = {'o3': 'dma8eu', 'relhum': 'average_values', 'temp': 'max
 DEFAULT_TRANSFORMATION = {"scope": "data", "method": "standardise", "mean": "estimate"}
 DEFAULT_PLOT_LIST = ["PlotMonthlySummary", "PlotStationMap", "PlotClimatologicalSkillScore", "PlotTimeSeries",
                      "PlotCompetitiveSkillScore", "PlotBootstrapSkillScore", "plot_conditional_quantiles"]
-DEFAULT_HPC_HOST_LIST = ["jw", "jr"] #first part of node names for Juwels (jw) and Jureca(jr).
+DEFAULT_HPC_HOST_LIST = ["jw", "ju", "jr"] #first part of node names for Juwels (jw[comp], ju[login]) and Jureca(jr).
 
 
 class ExperimentSetup(RunEnvironment):
-- 
GitLab