Skip to content

Commit 6b814f8

Browse files
Merge branch 'SSCHAcode:master' into master
2 parents e74119a + a8394db commit 6b814f8

14 files changed

Lines changed: 948 additions & 587 deletions

File tree

Modules/Cluster.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def __setattr__(self, name, value):
319319

320320

321321

322-
def ExecuteCMD(self, cmd, raise_error = True, return_output = False, on_cluster = False):
322+
def ExecuteCMD(self, cmd, raise_error = False, return_output = False, on_cluster = False):
323323
"""
324324
EXECUTE THE CMD ON THE CLUSTER
325325
==============================
@@ -797,7 +797,7 @@ def submit(self, script_location):
797797
#cmd = self.sshcmd + " %s '%s %s/%s.sh'" % (self.hostname, self.submit_command,
798798
# self.workdir, label+ "_" + str(indices[0]))
799799

800-
return self.ExecuteCMD(cmd, True, return_output=True)
800+
return self.ExecuteCMD(cmd, False, return_output=True)
801801

802802
def get_output_path(self, label):
803803
"""
@@ -996,7 +996,15 @@ def check_job_finished(self, job_id, verbose = True):
996996
lines = output.split("\n")
997997
if len(lines):
998998
for l in lines:
999-
data = l.strip().split()
999+
l = l.strip()
1000+
if not l:
1001+
if verbose:
1002+
now = datetime.datetime.now()
1003+
sys.stderr.write("{}/{}/{} - {}:{}:{} | job {}: No response from the server \n".format(now.year, now.month, now.day, now.hour, now.minute, now.second, job_id))
1004+
sys.stderr.flush()
1005+
return False
1006+
1007+
data = l.split()
10001008
if len(data) == 0:
10011009
if verbose:
10021010
now = datetime.datetime.now()
@@ -1367,7 +1375,7 @@ def setup_workdir(self, verbose = True):
13671375
sshcmd = self.sshcmd + " %s 'mkdir -p %s'" % (self.hostname,
13681376
workdir)
13691377

1370-
self.ExecuteCMD(sshcmd)
1378+
self.ExecuteCMD(sshcmd, raise_error= True)
13711379
#
13721380
# retval = os.system(sshcmd)
13731381
# if retval != 0:
@@ -1415,7 +1423,7 @@ def parse_string(self, string):
14151423

14161424
#print(cmd)
14171425

1418-
status, output = self.ExecuteCMD(cmd, return_output = True)
1426+
status, output = self.ExecuteCMD(cmd, return_output = True, raise_error= True)
14191427
#
14201428
# p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
14211429
# output, err = p.communicate()

0 commit comments

Comments
 (0)