diff --git a/wetb/hawc2/simulation.py b/wetb/hawc2/simulation.py index 8920ecb1856a0a7ecb3bac3fd4b754cd8fa36972..387f2913c1dbbf81b514689451b182343303df4b 100755 --- a/wetb/hawc2/simulation.py +++ b/wetb/hawc2/simulation.py @@ -388,6 +388,8 @@ class Simulation(object): def set_id(self, *args, **kwargs): pass + def progress_callback(self,*args, **kwargs): + pass class UpdateSimStatusThread(Thread): def __init__(self, simulation, interval=1): diff --git a/wetb/hawc2/simulation_resources.py b/wetb/hawc2/simulation_resources.py index 85b4a497094f9c2f18b177452a5560878293ef6e..8904ebddaef98357858bc277ecd3eb3b49a3552c 100644 --- a/wetb/hawc2/simulation_resources.py +++ b/wetb/hawc2/simulation_resources.py @@ -16,12 +16,11 @@ import time from wetb.hawc2 import log_file from wetb.hawc2.log_file import LogInfo, LogFile from wetb.hawc2.simulation import ERROR, ABORTED -from wetb.utils.cluster_tools import pbsjob + from wetb.utils.cluster_tools.cluster_resource import LocalResource, \ - SSHPBSClusterResource, unix_path + SSHPBSClusterResource +from wetb.utils.cluster_tools import pbsjob from wetb.utils.cluster_tools.pbsjob import SSHPBSJob, NOT_SUBMITTED, DONE -from wetb.utils.cluster_tools.ssh_client import SSHClient -from wetb.utils.timing import print_time from wetb.hawc2.htc_file import fmt_path import numpy as np @@ -249,7 +248,8 @@ class GormSimulationResource(PBSClusterSimulationResource): def __init__(self, username, password, wine_cmd="WINEARCH=win32 WINEPREFIX=~/.wine32 wine"): init_cmd = """export PATH=/home/python/miniconda3/bin:$PATH source activate wetb_py3""" - PBSClusterSimulationResource.__init__(self, "gorm.risoe.dk", username, password, 22, 25, 100, init_cmd, wine_cmd, "python") + from wetb.utils.cluster_tools.ssh_client import SSHClient + PBSClusterSimulationResource.__init__(self, SSHClient('gorm.risoe.dk', username, password, 22), 25, 100, init_cmd, wine_cmd, "python") class PBSClusterSimulationHost(SimulationHost): diff --git a/wetb/utils/cluster_tools/cluster_resource.py b/wetb/utils/cluster_tools/cluster_resource.py index 19714b5965153f03fd617c337c38c65e05281bd0..9bec834ef61c5ef1097410cabc22b1ca81afeda6 100644 --- a/wetb/utils/cluster_tools/cluster_resource.py +++ b/wetb/utils/cluster_tools/cluster_resource.py @@ -117,6 +117,10 @@ class SSHPBSClusterResource(Resource): @property def host(self): return self.ssh.host + + @property + def username(self): + return self.ssh.username def new_ssh_connection(self): diff --git a/wetb/utils/cluster_tools/pbsjob.py b/wetb/utils/cluster_tools/pbsjob.py index d1c1c99ec54246d467c42c94f17af921d6297dfb..0343b2de5a9a2d2bbf268f9bb86cf587f2f78ba2 100644 --- a/wetb/utils/cluster_tools/pbsjob.py +++ b/wetb/utils/cluster_tools/pbsjob.py @@ -4,7 +4,6 @@ Created on 04/12/2015 @author: mmpe ''' import os -from wetb.utils.cluster_tools.ssh_client import SSHClient NOT_SUBMITTED = "Job not submitted" PENDING = "Pending" @@ -38,7 +37,6 @@ class SSHPBSJob(object): @property def status(self): - if self._status in [NOT_SUBMITTED, DONE]: return self._status with self.ssh: diff --git a/wetb/utils/cluster_tools/ssh_client.py b/wetb/utils/cluster_tools/ssh_client.py index 0c8c8786f2e5e4133900f6c6a75d0a098cc04cc6..66886fe362554a1f47e1b2d387821f64e06c95cc 100644 --- a/wetb/utils/cluster_tools/ssh_client.py +++ b/wetb/utils/cluster_tools/ssh_client.py @@ -6,10 +6,7 @@ Created on 27/11/2015 from io import StringIO import sys -try: - import paramiko -except Exception as e: - sys.stderr.write("Paramiko(ssh client module) not imported\n%s"%str(e) ) +import paramiko import os import threading