jobsuberror.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 ######################################################################
3 #
4 # Name: jobsuberror.py
5 #
6 # Purpose: Python class JobsubError (exception class). This class captures
7 # the error status related to jobsub commands that return nonzero
8 # exit statuses. This exception would normally be raised after
9 # any failed jobsub command.
10 #
11 # This class contains four data members.
12 #
13 # command - Jobsub command (string).
14 # status - Jobsub exit status.
15 # out - Jobsub standard output.
16 # err - Jobsub diagnostic output.
17 #
18 # Created: 20-May-2015 Herbert Greenlee
19 #
20 ######################################################################
21 
22 from __future__ import absolute_import
23 from __future__ import print_function
24 
25 # Jobsub exception class.
26 
28 
29  def __init__(self, command, status, out, err):
30 
31  # Store command as a single string.
32  # For compatibility with subprocess module, the command may be passed
33  # as a list of words.
34 
35  self.command = ''
36  if type(command) == type([]):
37  for word in command:
38  self.command = self.command + ' ' + str(word)
39  else:
40  self.command = str(command)
41  self.status = int(status)
42  self.out = str(out)
43  self.err = str(err)
44  return
45 
46  def __str__(self):
47  s = '\nCommand: %s\nStatus: %d\nOutput: %s\nError: %s\n' % (
48  self.command, self.status, self.out, self.err)
49  return s
50 
51 
def __init__(self, command, status, out, err)
Definition: jobsuberror.py:29
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
static QCString str