From 9b514706bd7af49ae8bd95e3d9028d6505bc1415 Mon Sep 17 00:00:00 2001
From: Tamas Mona <tm689@cam.ac.uk>
Date: Thu, 12 May 2022 12:15:57 +0100
Subject: [PATCH] Add ssh and scp -v flag

---
 ProcessorComponents.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/ProcessorComponents.py b/ProcessorComponents.py
index 1e8b86c..c3839da 100644
--- a/ProcessorComponents.py
+++ b/ProcessorComponents.py
@@ -144,18 +144,18 @@ def calc_epi_date_range(init_str,span_days=[0,6]):
     day_shift = datetime.timedelta(days=1)
 
     # if more than 999 days
-    if len(str(span_days[0]))>3: 
+    if len(str(span_days[0]))>3:
         # assume it is a date string
         start_date = datetime.datetime.strptime(span_days[0]+'0300','%Y%m%d%H%M')
     else:
         date_shift0 = datetime.timedelta(days=span_days[0])
-    
+
         start_date = init_date + date_shift0 + threehour_shift
 
-    if len(str(span_days[1]))>3: 
+    if len(str(span_days[1]))>3:
         # assume it is a date string
         end_date = datetime.strptime(span_days[1]+'0000','%Y%m%d%H%M')
-        
+
         end_date = end_date + day_shift
     else:
         date_shift1 = datetime.timedelta(days=span_days[1])
@@ -1636,7 +1636,7 @@ def process_in_job_epi(jobPath,status,config,component):
             json.dump(config_epi,write_file,indent=4)
 
         # run epi model
-        
+
         try:
             EpiModel.run_epi_model(f"{case_specific_path}/{config_filename}.json")
         except:
@@ -1722,7 +1722,7 @@ def process_in_job_epi(jobPath,status,config,component):
             # from epi start time to forecast start time
             column_name = f"X{config['StartTimeShort']}_X{config['StartString']}0000"
             assert df_seasonsofar.name == column_name
-            
+
             #  save to csv
             df_seasonsofar.to_csv(fn_seasonsofar,header=True,index=True)
 
@@ -1737,7 +1737,7 @@ def process_in_job_epi(jobPath,status,config,component):
 
             # defined column name
             df_weekahead.name = '_'.join([df_fc_start_name,df_fc_end_name])
-            
+
             # save to csv
             df_weekahead.to_csv(fn_weekahead,header=True,index=True)
 
@@ -1981,7 +1981,7 @@ def process_EWS_plotting_epi(jobPath,config):
 
     deposition_dir = f"{config['WorkspacePath']}DEPOSITION_{start_string}/WR_NAME_{dep_regionname}_{start_string}/"
 
-    # TODO: handle multiple diseases and regions in Processor as a loop, or in the config 
+    # TODO: handle multiple diseases and regions in Processor as a loop, or in the config
     deposition_disease_name = [disease_latin_name_dict[disease]+'_DEPOSITION' for disease in diseases][0]
 
     ews_plot_dir = f"{jobPath}/plotting/"
@@ -2022,9 +2022,9 @@ def process_EWS_plotting_epi(jobPath,config):
         description_short = 'EWS-Plotting seasonsofar'
         description_long = description_short
         subprocess_and_log(plot_command_1, description_short, description_long,env=env_map)
-    
+
         # prepare command for weekahead
-        
+
         run_config = config['Epidemiology']['EWS-Plotting']['RunConfig_weekahead']
 
         # TODO: Is output unable to distinguish multiple diseases?
@@ -2094,7 +2094,7 @@ def upload(config,FilesToSend,component):
 
     logger.debug("Making path directory on remote server if it doesn't already exist")
 
-    ssh_cmd = ["ssh","-i",config['ServerKey'],config['ServerName'], f"mkdir -p {OutputServerPath}"]
+    ssh_cmd = ["ssh","-vvv","-i",config['ServerKey'],config['ServerName'], f"mkdir -p {OutputServerPath}"]
 
     description_short = 'upload ssh'
     description_long = 'make remote directory'
@@ -2102,7 +2102,7 @@ def upload(config,FilesToSend,component):
 
     logger.debug('Sending file(s) to remote server')
 
-    scp_cmd = ["scp","-ri",config['ServerKey'],*FilesToSend, f"{config['ServerName']}:{OutputServerPath}"]
+    scp_cmd = ["scp","-v","-ri",config['ServerKey'],*FilesToSend, f"{config['ServerName']}:{OutputServerPath}"]
 
     description_short = 'upload scp'
     description_long = 'scp files to remote directory'
-- 
GitLab