Build: #142 was successful

Job: Build and Package RHEL6 was successful

Stages & jobs

  1. Default Stage

Build log

The build generated 3,390 lines of output.The output is too long and has been truncated to the last 1,000 lines. Download or view full build log.

11-Sep-2019 22:12:43      # Get a list of all files in directory
11-Sep-2019 22:12:43 @@ -1091,7 +1013,6 @@ def get_directory_size(directory):
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43      get_directory_size - Return the size of a directory in bytes
11-Sep-2019 22:12:43         directory  --> the directory which is to be summed
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43         Returns Return the size, in bytes, of directory
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43      logging.debug("Executing: get_directory_size(directory = {})".format(directory))
11-Sep-2019 22:12:43 @@ -1109,7 +1030,6 @@ def get_table_column(table, colname):
11-Sep-2019 22:12:43         colname  --> column name
11-Sep-2019 22:12:43      Return the column as a dictionary
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      col = {}
11-Sep-2019 22:12:43      tb.open(table)
11-Sep-2019 22:12:43      if tb.isvarcol(colname):
11-Sep-2019 22:12:43 @@ -1117,11 +1037,9 @@ def get_table_column(table, colname):
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43          logging.error("Error Returning Column {}".format(colname))
11-Sep-2019 22:12:43          return None
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      tb.close()
11-Sep-2019 22:12:43      return col
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 def get_caltable_column(caltable, colname='CPARAM'):
11-Sep-2019 22:12:43      ''' Open a caltable and get the provided column
11-Sep-2019 22:12:43         caltable    --> name of cal table
11-Sep-2019 22:12:43 @@ -1134,7 +1052,7 @@ def get_caltable_column(caltable, colname='CPARAM'):
11-Sep-2019 22:12:43      return outtable
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def get_column_shape(tab,col,start_row=0,nrow=1,row_inc=1):
11-Sep-2019 22:12:43 -    '''
11-Sep-2019 22:12:43 +    '''
11-Sep-2019 22:12:43      Get the shape of the given column.
11-Sep-2019 22:12:43      Keyword arguments:
11-Sep-2019 22:12:43          tab        --    input table or MS
11-Sep-2019 22:12:43 @@ -1142,11 +1060,8 @@ def get_column_shape(tab,col,start_row=0,nrow=1,row_inc=1):
11-Sep-2019 22:12:43          start_row  --    start row (default 0)
11-Sep-2019 22:12:43          nrow       --    number of rows to read (default 1)
11-Sep-2019 22:12:43          row_inc    --    increment of rows to read (default 1)
11-Sep-2019 22:12:43 -       
11-Sep-2019 22:12:43          Return a list of strings with the shape of each row in the column.
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      col_shape = []
11-Sep-2019 22:12:43      try:
11-Sep-2019 22:12:43          try:
11-Sep-2019 22:12:43 @@ -1154,19 +1069,16 @@ def get_column_shape(tab,col,start_row=0,nrow=1,row_inc=1):
11-Sep-2019 22:12:43              col_shape = tb.getcolshapestring(col,start_row,nrow,row_inc)
11-Sep-2019 22:12:43          except:
11-Sep-2019 22:12:43              print('Cannot get shape of col {} from table {} '.format(col,tab))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      finally:
11-Sep-2019 22:12:43          tb.close()
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43      return col_shape
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_plotfile(plotfileName, min_size, max_size=None):
11-Sep-2019 22:12:43 -    '''
11-Sep-2019 22:12:43 +    '''
11-Sep-2019 22:12:43      Check if plotfile generated is cprrect size
11-Sep-2019 22:12:43          plotfileName --> Name of plotted Image
11-Sep-2019 22:12:43          min_size -- > Min Size of image
11-Sep-2019 22:12:43          max_size --> Max Size of image
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43          Return : True if image size > min_size ( and < max_size if max_size is provided )
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43      val = False
11-Sep-2019 22:12:43 @@ -1178,21 +1090,18 @@ def check_plotfile(plotfileName, min_size, max_size=None):
11-Sep-2019 22:12:43          if max_size is not None:
11-Sep-2019 22:12:43              if not plotSize < max_size:
11-Sep-2019 22:12:43                  val = False
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43          logging.critical("Plot was not created")
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43      return val
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def generate_weblog(task,dictionary):
11-Sep-2019 22:12:43 +def generate_weblog(task,dictionary,show_passed = True):
11-Sep-2019 22:12:43      """Generate Test Summary Weblog
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    Example:
11-Sep-2019 22:12:43 -        generate_weblog("taskname", dictionary)
11-Sep-2019 22:12:43 +    Example:
11-Sep-2019 22:12:43 +        generate_weblog("taskname", dictionary, show_passed)
11-Sep-2019 22:12:43      """
11-Sep-2019 22:12:43      global html
11-Sep-2019 22:12:43      html = open("test_{}_weblog.html".format(task.lower()), 'w')
11-Sep-2019 22:12:43 -    Weblog(task, dictionary).generate_weblog()
11-Sep-2019 22:12:43 +    Weblog(task, dictionary).generate_weblog(show_passed = show_passed)
11-Sep-2019 22:12:43      html.close()
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 ############################################################################################
11-Sep-2019 22:12:43 @@ -1200,34 +1109,29 @@ def generate_weblog(task,dictionary):
11-Sep-2019 22:12:43 ############################################################################################
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_model(msname=""):
11-Sep-2019 22:12:43 +    """Check hasmodcol, modsum, hasvirmod"""
11-Sep-2019 22:12:43      logging.debug("Executing: check_model(msname={})".format(msname))
11-Sep-2019 22:12:43      hasmodcol = False
11-Sep-2019 22:12:43      modsum=0.0
11-Sep-2019 22:12:43      hasvirmod = False
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      tb.open( msname )
11-Sep-2019 22:12:43      hasmodcol = (  (tb.colnames()).count('MODEL_DATA')>0 )
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if hasmodcol:
11-Sep-2019 22:12:43          model_data = tb.getcol('MODEL_DATA')
11-Sep-2019 22:12:43          modsum = model_data.sum()
11-Sep-2019 22:12:43      tb.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      tb.open( msname+'/SOURCE' )
11-Sep-2019 22:12:43      keys = tb.getkeywords()
11-Sep-2019 22:12:43      if len(keys)>0:
11-Sep-2019 22:12:43          hasvirmod=True
11-Sep-2019 22:12:43      tb.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      tb.open( msname )
11-Sep-2019 22:12:43      keys = tb.getkeywords()
11-Sep-2019 22:12:43      for key in keys:
11-Sep-2019 22:12:43          if key.count("model_")>0:
11-Sep-2019 22:12:43              hasvirmod=True
11-Sep-2019 22:12:43      tb.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      logging.info("MS Name: {}, modelcol= {},  modsum = {}, virmod = {}".format( msname, hasmodcol, modsum, hasvirmod ))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      return hasmodcol, modsum, hasvirmod
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def get_max(imname):
11-Sep-2019 22:12:43 @@ -1255,11 +1159,10 @@ def get_pixmask(imname,pos):
11-Sep-2019 22:12:43      ia.open(imname)
11-Sep-2019 22:12:43      apos = ia.pixelvalue(pos)
11-Sep-2019 22:12:43      ia.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if apos == {}:
11-Sep-2019 22:12:43 -       return None
11-Sep-2019 22:12:43 +        return None
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43 -       return apos['mask']
11-Sep-2019 22:12:43 +        return apos['mask']
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_beam_compare(image1, image2, op=operator.le):
11-Sep-2019 22:12:43      """Compare all plane of cube beam image1 operator op than image1"""
11-Sep-2019 22:12:43 @@ -1269,7 +1172,6 @@ def check_beam_compare(image1, image2, op=operator.le):
11-Sep-2019 22:12:43      for k in range(nchan):
11-Sep-2019 22:12:43          beam1[k]= ia.beamarea(k,0)['arcsec2']
11-Sep-2019 22:12:43      ia.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      ia.open(image2)
11-Sep-2019 22:12:43      if(nchan != ia.shape()[3]):
11-Sep-2019 22:12:43          return False
11-Sep-2019 22:12:43 @@ -1277,7 +1179,6 @@ def check_beam_compare(image1, image2, op=operator.le):
11-Sep-2019 22:12:43      for k in range(nchan):
11-Sep-2019 22:12:43          beam2[k] = ia.beamarea(k,0)['arcsec2']
11-Sep-2019 22:12:43      ia.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      return numpy.alltrue(op(beam1, beam2))
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def exists(imname):
11-Sep-2019 22:12:43 @@ -1285,6 +1186,7 @@ def exists(imname):
11-Sep-2019 22:12:43      return os.path.exists(imname)
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def get_peak_res(summ):
11-Sep-2019 22:12:43 +    """Get Peak Res"""
11-Sep-2019 22:12:43      if summ.has_key('summaryminor'):
11-Sep-2019 22:12:43          reslist = summ['summaryminor'][1,:]
11-Sep-2019 22:12:43          peakres = reslist[ len(reslist)-1 ]
11-Sep-2019 22:12:43 @@ -1292,18 +1194,16 @@ def get_peak_res(summ):
11-Sep-2019 22:12:43          peakres = None
11-Sep-2019 22:12:43      return peakres
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 def check_peak_res(summ,correctres, epsilon=0.05):
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +    """Check Peak Res"""
11-Sep-2019 22:12:43      peakres = get_peak_res(summ)
11-Sep-2019 22:12:43      out = True
11-Sep-2019 22:12:43 -    if correctres == None and peakres != None:
11-Sep-2019 22:12:43 +    if correctres == None and peakres != None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43          return out,peakres
11-Sep-2019 22:12:43 -    if correctres != None and peakres == None:
11-Sep-2019 22:12:43 +    if correctres != None and peakres == None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43          return out,peakres
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if out==True and peakres != None:
11-Sep-2019 22:12:43          if abs(correctres - peakres)/abs(correctres) > epsilon:
11-Sep-2019 22:12:43              out=False
11-Sep-2019 22:12:43 @@ -1311,30 +1211,32 @@ def check_peak_res(summ,correctres, epsilon=0.05):
11-Sep-2019 22:12:43      return out,peakres
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def get_mod_flux(summ):
11-Sep-2019 22:12:43 +    """Get Mod Flux"""
11-Sep-2019 22:12:43      if summ.has_key('summaryminor'):
11-Sep-2019 22:12:43          modlist = summ['summaryminor'][2,:]
11-Sep-2019 22:12:43          modflux = modlist[ len(modlist)-1 ]
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43          modflux = None
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      return modflux
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_mod_flux(summ,correctmod, epsilon=0.05):
11-Sep-2019 22:12:43 +    """Check Mod Flux"""
11-Sep-2019 22:12:43      modflux = get_mod_flux(summ)
11-Sep-2019 22:12:43      out = True
11-Sep-2019 22:12:43 -    if correctmod == None and modflux != None:
11-Sep-2019 22:12:43 +    if correctmod == None and modflux != None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43 -        return out,peakres
11-Sep-2019 22:12:43 -    if correctmod != None and modflux == None:
11-Sep-2019 22:12:43 +        return out,modflux
11-Sep-2019 22:12:43 +    if correctmod != None and modflux == None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43 -        return out,peakres
11-Sep-2019 22:12:43 +        return out,modflux
11-Sep-2019 22:12:43      if out==True and modflux != None:
11-Sep-2019 22:12:43          if abs(correctmod - modflux)/abs(correctmod) > epsilon:
11-Sep-2019 22:12:43              out=False
11-Sep-2019 22:12:43 -            return out,peakres
11-Sep-2019 22:12:43 +            return out,modflux
11-Sep-2019 22:12:43      return out,modflux
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def get_iter_done(summ):
11-Sep-2019 22:12:43 +    """Get Iterdone"""
11-Sep-2019 22:12:43      if summ.has_key('iterdone'):
11-Sep-2019 22:12:43          iters = summ['iterdone']
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43 @@ -1342,136 +1244,99 @@ def get_iter_done(summ):
11-Sep-2019 22:12:43      return iters
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def verdict(boolval):
11-Sep-2019 22:12:43 +    """Return the string 'Pass' if boolean is True, Else return string 'Fail'"""
11-Sep-2019 22:12:43      return "Pass" if boolval else "Fail"
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_ret( summ,correctres,correctmod,epsilon = 0.05):
11-Sep-2019 22:12:43 +############################################################################################
11-Sep-2019 22:12:43 +##############################       imagerhelpers: Checks       ###########################
11-Sep-2019 22:12:43 +############################################################################################
11-Sep-2019 22:12:43 +
11-Sep-2019 22:12:43 +def check_ret( summ,correctres,correctmod,epsilon = 0.05, testname ="check_ret"):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[1][3] # Make Sure this is correct
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43      retres, peakres = check_peak_res(summ, correctres, epsilon)
11-Sep-2019 22:12:43      retmod, modflux = check_mod_flux(summ, correctmod, epsilon)
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43 -    pstr_peak =  "[ {} ] PeakRes is  {}  ( {} : should be  {} + )\n".format(testname, str(peakres), verdict(retres) , str(correctres))
11-Sep-2019 22:12:43 -    pstr_mod  =  "[ {} ] Modflux is  {}  ( {} : should be  {} + )\n".format(testname, str(modflux), verdict(retmod) , str(correctmod))
11-Sep-2019 22:12:43 +    pstr_peak =  "[ {} ] PeakRes is  {}  ( {} : should be  {}, Epsilon: {} + )\n".format(testname, str(peakres), verdict(retres) , str(correctres), str(epsilon))
11-Sep-2019 22:12:43 +    pstr_mod  =  "[ {} ] Modflux is  {}  ( {} : should be  {}, Epsilon: {} + )\n".format(testname, str(modflux), verdict(retmod) , str(correctmod), str(epsilon))
11-Sep-2019 22:12:43      pstr =  pstr_peak + pstr_mod
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43 -    if retres==False or retmod==False:
11-Sep-2019 22:12:43 +    if retres == False or retmod == False:
11-Sep-2019 22:12:43          return False, pstr
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43          return True, pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_val(val, correctval, valname='Value', exact=False, epsilon=0.05):
11-Sep-2019 22:12:43 +def check_val(val, correctval, valname='Value', exact=False, epsilon=0.05, testname = "check_val"):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3] # Make Sure this is correct
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      out = True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if numpy.isnan(val) or numpy.isinf(val):
11-Sep-2019 22:12:43 -        out=False
11-Sep-2019 22:12:43 -    if correctval == None and val != None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43 -    if correctval != None and val == None:
11-Sep-2019 22:12:43 +    if correctval == None and val != None:
11-Sep-2019 22:12:43 +        out = False
11-Sep-2019 22:12:43 +    if correctval != None and val == None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43      if out==True and val != None:
11-Sep-2019 22:12:43          if exact==True:
11-Sep-2019 22:12:43              if correctval != val:
11-Sep-2019 22:12:43 -                out=False
11-Sep-2019 22:12:43 +                out = False
11-Sep-2019 22:12:43          else:
11-Sep-2019 22:12:43              if abs(correctval - val)/abs(correctval) > epsilon:
11-Sep-2019 22:12:43                  out=False
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    pstr = "[ {} ] {} is {} ( {} : should be {} )\n".format(testname, valname, str(val), verdict(out), str(correctval) )
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +    pstr = "[ {} ] {} is {} ( {} : should be {}, Epsilon: {})\n".format(testname, valname, str(val), verdict(out), str(correctval), str(epsilon) )
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return out, pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_val_less_than(val, bound, valname='Value'):
11-Sep-2019 22:12:43 +def check_val_less_than(val, bound, valname='Value',testname ="check_val_less_than"):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3] # Make Sure this is correct
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      out = True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if numpy.isnan(val) or numpy.isinf(val):
11-Sep-2019 22:12:43 -        out=False
11-Sep-2019 22:12:43 +        out = False
11-Sep-2019 22:12:43      if bound == None and val != None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43      if bound != None and val == None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43 -    if out==True and val != None:
11-Sep-2019 22:12:43 +    if out == True and val != None:
11-Sep-2019 22:12:43          if val > bound:
11-Sep-2019 22:12:43 -                out=False
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +            out = False
11-Sep-2019 22:12:43      pstr = "[ {} ] {} is {} ( {} : should be less than {} )\n".format(testname, valname, str(val), verdict(out), str(bound))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return out, pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_val_greater_than(val, bound, valname='Value'):
11-Sep-2019 22:12:43 +def check_val_greater_than(val, bound, valname='Value',testname ="check_val_greater_than"):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3] # Make Sure this is correct
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      out = True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if numpy.isnan(val) or numpy.isinf(val):
11-Sep-2019 22:12:43 -        out=False
11-Sep-2019 22:12:43 +        out = False
11-Sep-2019 22:12:43      if bound == None and val != None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43      if bound != None and val == None:
11-Sep-2019 22:12:43          out = False
11-Sep-2019 22:12:43      if out==True and val != None:
11-Sep-2019 22:12:43          if val < bound:
11-Sep-2019 22:12:43 -                out=False
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +            out = False
11-Sep-2019 22:12:43      pstr = "[ {} ] {} is {} ( {} : should be greater than {} )\n".format(testname, valname, str(val), verdict(out), str(bound))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return out, pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_ims(imlist,truth):
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3]
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    imex=[]
11-Sep-2019 22:12:43 -    out=True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +def check_ims(imlist, truth, testname="check_ims"):
11-Sep-2019 22:12:43 +    pstr = ''
11-Sep-2019 22:12:43 +    imex = []
11-Sep-2019 22:12:43 +    out = True
11-Sep-2019 22:12:43      for imname in imlist:
11-Sep-2019 22:12:43          ondisk = exists(imname)
11-Sep-2019 22:12:43 -        imex.append( ondisk )
11-Sep-2019 22:12:43 +        imex.append(ondisk)
11-Sep-2019 22:12:43          if ondisk != truth:
11-Sep-2019 22:12:43 -            out=False
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    pstr = "[ {} ] Image made : {} =  {} ( {} : should all be {} )\n".format(testname, str(imlist), str(imex), verdict(out),str(truth))
11-Sep-2019 22:12:43 +            out = False
11-Sep-2019 22:12:43 +    pstr = "[ {} ] Image made : {} =  {} ( {} : should all be {} )\n".format(testname, str(imlist), str(imex), verdict(out), str(truth))
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_keywords(imlist):
11-Sep-2019 22:12:43 +def check_keywords(imlist, testname="check_keywords"):
11-Sep-2019 22:12:43      """
11-Sep-2019 22:12:43      Keyword related checks (presence/absence of records and entries in these records,
11-Sep-2019 22:12:43      in the keywords of the image table).
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      :param imlist: names of the images produced by a test execution.
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      :returns: the usual (test_imager_helper) string with success/error messages.
11-Sep-2019 22:12:43      """
11-Sep-2019 22:12:43      # Keeping the general approach. This is fragile!
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3]
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      # accumulator of error strings
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      for imname in imlist:
11-Sep-2019 22:12:43 @@ -1479,7 +1344,6 @@ def check_keywords(imlist):
11-Sep-2019 22:12:43              issues = check_im_keywords(imname, check_misc=True, check_extended=True)
11-Sep-2019 22:12:43              if issues:
11-Sep-2019 22:12:43                  pstr += '[{0}] {1}: {2}'.format(testname, imname, issues)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if not pstr:
11-Sep-2019 22:12:43          pstr += 'All expected keywords in imageinfo, miscinfo, and coords found.\n'
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43 @@ -1490,22 +1354,18 @@ def check_im_keywords(imname, check_misc=True, check_extended=True):
11-Sep-2019 22:12:43      keywords.
11-Sep-2019 22:12:43      Forbidden keywords lists introduced with CAS-9231 (prevent duplication of
11-Sep-2019 22:12:43      TELESCOP and OBJECT).
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      Note that if imname is the top level of a refconcat image, there's no table to open
11-Sep-2019 22:12:43      to look for its keywords. In these cases nothing is checked. We would not have the
11-Sep-2019 22:12:43      'imageinfo' keywords, only the MiscInfo that goes in imageconcat.json and I'm not
11-Sep-2019 22:12:43      sure yet how that one is supposed to behave.
11-Sep-2019 22:12:43      Tests should check the 'getNParts() from imname' to make sure the components of
11-Sep-2019 22:12:43      the refconcat image exist, have the expected keywords, etc.
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      :param imname: image name (output image from tclean)
11-Sep-2019 22:12:43      :param check_misc: whether to check miscinfo in addition to imageinfo'
11-Sep-2019 22:12:43      :param check_extended: can leave enabled for images other than .tt?, .alpha, etc.
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      :returns: the usual (test_imager_helper) string with success/error messages.
11-Sep-2019 22:12:43      Errors marked with '(Fail' as per self.verdict().
11-Sep-2019 22:12:43      """
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      try:
11-Sep-2019 22:12:43          tbt.open(imname)
11-Sep-2019 22:12:43          keys = tbt.getkeywords()
11-Sep-2019 22:12:43 @@ -1521,12 +1381,10 @@ def check_im_keywords(imname, check_misc=True, check_extended=True):
11-Sep-2019 22:12:43              return pstr
11-Sep-2019 22:12:43      finally:
11-Sep-2019 22:12:43          tbt.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if len(keys) <= 0:
11-Sep-2019 22:12:43          pstr += ('No keywords found ({0})\n'.format(verdict(False)))
11-Sep-2019 22:12:43 -    return pstr
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +        return pstr
11-Sep-2019 22:12:43      # Records that need to be present
11-Sep-2019 22:12:43      imageinfo = 'imageinfo'
11-Sep-2019 22:12:43      miscinfo = 'miscinfo'
11-Sep-2019 22:12:43 @@ -1537,26 +1395,20 @@ def check_im_keywords(imname, check_misc=True, check_extended=True):
11-Sep-2019 22:12:43      for rec in mandatory_recs:
11-Sep-2019 22:12:43          if rec not in keys:
11-Sep-2019 22:12:43              pstr += ('{0} record not found ({1})\n'.format(rec, verdict(False)))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if len(pstr) > 0:
11-Sep-2019 22:12:43          return pstr
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      mandatory_imageinfo = ['objectname', 'imagetype']
11-Sep-2019 22:12:43      pstr += check_expected_entries(mandatory_imageinfo, imageinfo, keys)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      if check_misc:
11-Sep-2019 22:12:43          if check_extended:
11-Sep-2019 22:12:43              mandatory_miscinfo = ['INSTRUME', 'distance']
11-Sep-2019 22:12:43              pstr += check_expected_entries(mandatory_miscinfo, miscinfo, keys)
11-Sep-2019 22:12:43          forbidden_miscinfo = ['OBJECT', 'TELESCOP']
11-Sep-2019 22:12:43          pstr += check_forbidden_entries(forbidden_miscinfo, miscinfo, keys)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      mandatory_coords = ['telescope']
11-Sep-2019 22:12:43      pstr += check_expected_entries(mandatory_coords, coords, keys)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -def check_expected_entries( entries, record, keys):
11-Sep-2019 22:12:43 +def check_expected_entries(entries, record, keys):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      for entry in entries:
11-Sep-2019 22:12:43          if entry not in keys[record]:
11-Sep-2019 22:12:43 @@ -1567,96 +1419,78 @@ def check_expected_entries( entries, record, keys):
11-Sep-2019 22:12:43                  pstr += ('entry {0} is found in record {1} but it is empty ({2})\n'.format(entry, record, verdict(False)))
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_forbidden_entries( entries, record, keys):
11-Sep-2019 22:12:43 +def check_forbidden_entries(entries, record, keys):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      for entry in entries:
11-Sep-2019 22:12:43          if entry in keys[record]:
11-Sep-2019 22:12:43              pstr += ('entry {0} should not be in record {1} ({2})\n'.format(entry, record, verdict(False)))
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_pix_val(imname,theval=0, thepos=[0,0,0,0], exact=False,  epsilon=0.05):
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3]
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    readval = get_pix(imname,thepos)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    res=True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    if readval==None:
11-Sep-2019 22:12:43 -        res=False
11-Sep-2019 22:12:43 +def check_pix_val(imname, theval=0, thepos=[0, 0, 0, 0], exact=False, epsilon=0.05, testname="check_pix_val"):
11-Sep-2019 22:12:43 +    pstr = ''
11-Sep-2019 22:12:43 +    readval = get_pix(imname, thepos)
11-Sep-2019 22:12:43 +    res = True
11-Sep-2019 22:12:43 +    if readval == None:
11-Sep-2019 22:12:43 +        res = False
11-Sep-2019 22:12:43      elif numpy.isnan(readval) or numpy.isinf(readval):
11-Sep-2019 22:12:43 -        res=False
11-Sep-2019 22:12:43 +        res = False
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43          if abs(theval) > epsilon:
11-Sep-2019 22:12:43 -            if exact==False:
11-Sep-2019 22:12:43 -                if abs(readval - theval)/abs(theval) > epsilon:
11-Sep-2019 22:12:43 +            if exact == False:
11-Sep-2019 22:12:43 +                if abs(readval - theval)/abs(theval) > epsilon:
11-Sep-2019 22:12:43                      res = False
11-Sep-2019 22:12:43                  else:
11-Sep-2019 22:12:43 -                   res = True
11-Sep-2019 22:12:43 +                    res = True
11-Sep-2019 22:12:43              else:
11-Sep-2019 22:12:43 -                if abs(readval - theval) > 0.0:
11-Sep-2019 22:12:43 -                   res = False
11-Sep-2019 22:12:43 +                if abs(readval - theval) > 0.0:
11-Sep-2019 22:12:43 +                    res = False
11-Sep-2019 22:12:43                  else:
11-Sep-2019 22:12:43 -                   res = True
11-Sep-2019 22:12:43 +                    res = True
11-Sep-2019 22:12:43          else:  ## this is to guard against exact zero... sort of.
11-Sep-2019 22:12:43 -            if abs(readval - theval) > epsilon:
11-Sep-2019 22:12:43 +            if abs(readval - theval) > epsilon:
11-Sep-2019 22:12:43                  res = False
11-Sep-2019 22:12:43              else:
11-Sep-2019 22:12:43                  res = True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    pstr =  "[ {} ] {} : Value is {} at {} ( {} : should be {} )\n".format(testname, imname, str(readval), str(thepos), verdict(res), str(theval))
11-Sep-2019 22:12:43 +    pstr = "[ {} ] {} : Value is {} at {} ( {} : should be {} , Epsilon: {})\n".format(testname, imname, str(readval), str(thepos), verdict(res), str(theval), str(epsilon))
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_pixmask(imname,theval=True, thepos=[0,0,0,0]):
11-Sep-2019 22:12:43 -    if casa5:
11-Sep-2019 22:12:43 -        testname = inspect.stack()[2][3]
11-Sep-2019 22:12:43 -    else:
11-Sep-2019 22:12:43 -        testname = "TODO"
11-Sep-2019 22:12:43 -    readval = get_pixmask(imname,thepos)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    res=True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    if readval==None:
11-Sep-2019 22:12:43 -        res=False
11-Sep-2019 22:12:43 -    elif numpy.isnan(readval) or numpy.isinf(readval) or type(readval)!=bool:
11-Sep-2019 22:12:43 -        res=False
11-Sep-2019 22:12:43 +def check_pixmask(imname, theval=True, thepos=[0, 0, 0, 0], testname="check_pixmask"):
11-Sep-2019 22:12:43 +    pstr = ''
11-Sep-2019 22:12:43 +    readval = get_pixmask(imname, thepos)
11-Sep-2019 22:12:43 +    res = True
11-Sep-2019 22:12:43 +    if readval == None:
11-Sep-2019 22:12:43 +        res = False
11-Sep-2019 22:12:43 +    elif numpy.isnan(readval) or numpy.isinf(readval) or type(readval) != bool:
11-Sep-2019 22:12:43 +        res = False
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43          if readval == theval:
11-Sep-2019 22:12:43              res = True
11-Sep-2019 22:12:43          else:
11-Sep-2019 22:12:43              res = False
11-Sep-2019 22:12:43 -    pstr =  "[ {} ] {} : Mask is {} at {} ( {} : should be {} )\n".format(testname, imname, str(readval), str(thepos), verdict(res), str(theval))
11-Sep-2019 22:12:43 +    pstr = "[ {} ] {} : Mask is {} at {} ( {} : should be {} )\n".format(testname, imname, str(readval), str(thepos), verdict(res), str(theval))
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_ref_freq(imname,theval=0, epsilon=0.05):
11-Sep-2019 22:12:43 -    testname = inspect.stack()[2][3]
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    retres=True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +def check_ref_freq(imname, theval=0, epsilon=0.05, testname="check_ref_freq"):
11-Sep-2019 22:12:43 +    pstr = ''
11-Sep-2019 22:12:43 +    retres = True
11-Sep-2019 22:12:43      ia.open(imname)
11-Sep-2019 22:12:43      csys = ia.coordsys()
11-Sep-2019 22:12:43      ia.close()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      reffreq = csys.referencevalue()['numeric'][3]
11-Sep-2019 22:12:43 -    if  abs(reffreq - theval)/theval > epsilon :
11-Sep-2019 22:12:43 -        retres=False
11-Sep-2019 22:12:43 +    if  abs(reffreq - theval)/theval > epsilon:
11-Sep-2019 22:12:43 +        retres = False
11-Sep-2019 22:12:43      else:
11-Sep-2019 22:12:43 -        retres=True
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    pstr = "[ {} ] Ref-Freq is {} ( {} : should be {} )\n".format(testname , str(reffreq) , verdict(retres),  str(theval))
11-Sep-2019 22:12:43 +        retres = True
11-Sep-2019 22:12:43 +    pstr = "[ {} ] Ref-Freq is {} ( {} : should be {} )\n".format(testname, str(reffreq), verdict(retres), str(theval))
11-Sep-2019 22:12:43      logging.info(pstr)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -###################################
11-Sep-2019 22:12:43 def check_imexist(imgexist):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if imgexist != None:
11-Sep-2019 22:12:43 -        if type(imgexist)==list:
11-Sep-2019 22:12:43 +        if type(imgexist) == list:
11-Sep-2019 22:12:43              pstr += check_ims(imgexist, True)
11-Sep-2019 22:12:43              print("pstr after checkims = {}".format(pstr))
11-Sep-2019 22:12:43              pstr += check_keywords(imgexist)
11-Sep-2019 22:12:43 @@ -1666,50 +1500,50 @@ def check_imexist(imgexist):
11-Sep-2019 22:12:43 def check_imexistnot(imgexistnot):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if imgexistnot != None:
11-Sep-2019 22:12:43 -        if type(imgexistnot)==list:
11-Sep-2019 22:12:43 +        if type(imgexistnot) == list:
11-Sep-2019 22:12:43              pstr += check_ims(imgexistnot, False)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_imval(imgval, epsilon=0.05):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if imgval != None:
11-Sep-2019 22:12:43 -        if type(imgval)==list:
11-Sep-2019 22:12:43 +        if type(imgval) == list:
11-Sep-2019 22:12:43              for ii in imgval:
11-Sep-2019 22:12:43 -                if type(ii)==tuple and len(ii)==3:
11-Sep-2019 22:12:43 -                    pstr += check_pix_val(ii[0],ii[1],ii[2],epsilon=epsilon)
11-Sep-2019 22:12:43 +                if type(ii) == tuple and len(ii) == 3:
11-Sep-2019 22:12:43 +                    pstr += check_pix_val(ii[0], ii[1], ii[2], epsilon=epsilon)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_imvalexact(imgvalexact, epsilon=0.05):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if imgvalexact != None:
11-Sep-2019 22:12:43 -        if type(imgvalexact)==list:
11-Sep-2019 22:12:43 +        if type(imgvalexact) == list:
11-Sep-2019 22:12:43              for ii in imgvalexact:
11-Sep-2019 22:12:43 -                if type(ii)==tuple and len(ii)==3:
11-Sep-2019 22:12:43 -                    pstr += check_pix_val(ii[0],ii[1],ii[2], exact=True,epsilon=epsilon)
11-Sep-2019 22:12:43 +                if type(ii) == tuple and len(ii) == 3:
11-Sep-2019 22:12:43 +                    pstr += check_pix_val(ii[0], ii[1], ii[2], exact=True, epsilon=epsilon)
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_immask(imgmask):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if imgmask != None:
11-Sep-2019 22:12:43 -        if type(imgmask)==list:
11-Sep-2019 22:12:43 +        if type(imgmask) == list:
11-Sep-2019 22:12:43              for ii in imgmask:
11-Sep-2019 22:12:43 -                if type(ii)==tuple and len(ii)==3:
11-Sep-2019 22:12:43 -                    pstr += check_pixmask(ii[0],ii[1],ii[2])
11-Sep-2019 22:12:43 +                if type(ii) == tuple and len(ii) == 3:
11-Sep-2019 22:12:43 +                    pstr += check_pixmask(ii[0], ii[1], ii[2])
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_tabcache(tabcache):
11-Sep-2019 22:12:43 +def check_tabcache(tabcache, testname="check_tabcache"):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43 -    if tabcache==True:
11-Sep-2019 22:12:43 +    if tabcache == True:
11-Sep-2019 22:12:43          opentabs = tb.showcache()
11-Sep-2019 22:12:43 -        if len(opentabs)>0 :
11-Sep-2019 22:12:43 -            pstr += "["+inspect.stack()[1][3]+"] " + verdict(False) + ": Found open tables after run \n"
11-Sep-2019 22:12:43 +        if len(opentabs) > 0:
11-Sep-2019 22:12:43 +            pstr += "["+ testname +"] " + verdict(False) + ": Found open tables after run \n"
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -def check_stopcode(stopcode):
11-Sep-2019 22:12:43 +def check_stopcode(stopcode, ret, testname="check_stopcode"):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if stopcode != None:
11-Sep-2019 22:12:43 -        if type(stopcode)==int:
11-Sep-2019 22:12:43 -            stopstr = "["+inspect.stack()[1][3]+"] Stopcode is " + str(ret['stopcode']) + " (" + verdict(ret['stopcode']==stopcode)  +  " : should be " + str(stopcode) + ")\n"
11-Sep-2019 22:12:43 +        if type(stopcode) == int:
11-Sep-2019 22:12:43 +            stopstr = "["+ testname +"] Stopcode is " + str(ret['stopcode']) + " (" + verdict(ret['stopcode'] == stopcode)  +  " : should be " + str(stopcode) + ")\n"
11-Sep-2019 22:12:43              print(stopstr)
11-Sep-2019 22:12:43              pstr += stopstr
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43 @@ -1717,14 +1551,13 @@ def check_stopcode(stopcode):
11-Sep-2019 22:12:43 def check_reffreq(reffreq):
11-Sep-2019 22:12:43      pstr = ''
11-Sep-2019 22:12:43      if reffreq != None:
11-Sep-2019 22:12:43 -        if type(reffreq)==list:
11-Sep-2019 22:12:43 +        if type(reffreq) == list:
11-Sep-2019 22:12:43              for ii in reffreq:
11-Sep-2019 22:12:43 -                if type(ii)==tuple and len(ii)==2:
11-Sep-2019 22:12:43 -                    pstr += check_ref_freq(ii[0],ii[1])
11-Sep-2019 22:12:43 +                if type(ii) == tuple and len(ii) == 2:
11-Sep-2019 22:12:43 +                    pstr += check_ref_freq(ii[0], ii[1])
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -def checkall( ret=None, peakres=None, modflux=None, iterdone=None, nmajordone=None, imgexist=None, imgexistnot=None, imgval=None, imgvalexact=None, imgmask=None,  tabcache=True, stopcode=None, reffreq=None, epsilon=0.05 ):
11-Sep-2019 22:12:43 +def checkall(ret=None, peakres=None, modflux=None, iterdone=None, nmajordone=None, imgexist=None, imgexistnot=None, imgval=None, imgvalexact=None, imgmask=None, tabcache=True, stopcode=None, reffreq=None, epsilon=0.05):
11-Sep-2019 22:12:43      """
11-Sep-2019 22:12:43          ret=None,
11-Sep-2019 22:12:43          peakres=None, # a float
11-Sep-2019 22:12:43 @@ -1740,76 +1573,66 @@ def checkall( ret=None, peakres=None, modflux=None, iterdone=None, nmajordone=No
11-Sep-2019 22:12:43          stopcode=None,
11-Sep-2019 22:12:43          reffreq=None # list of tuples of (imagename, reffreq)
11-Sep-2019 22:12:43      """
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    pstr = ""
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -    if ret != None and type(ret)==dict:
11-Sep-2019 22:12:43 +    pstr = "[ checkall ] \n"
11-Sep-2019 22:12:43 +    if ret != None and type(ret) == dict:
11-Sep-2019 22:12:43          try:
11-Sep-2019 22:12:43              if peakres != None:
11-Sep-2019 22:12:43 -                pstr += check_val( val=get_peak_res(ret), correctval=peakres, valname="peak res" )
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +                pstr += check_val(val=get_peak_res(ret), correctval=peakres, valname="peak res")
11-Sep-2019 22:12:43              if modflux != None:
11-Sep-2019 22:12:43 -                pstr += check_val( val=get_mod_flux(ret), correctval=modflux, valname="mod flux" )
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +                pstr += check_val(val=get_mod_flux(ret), correctval=modflux, valname="mod flux")
11-Sep-2019 22:12:43              if iterdone != None:
11-Sep-2019 22:12:43 -                pstr += check_val( val=ret['iterdone'], correctval=iterdone, valname="iterdone", exact=True )
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +                pstr += check_val(val=ret['iterdone'], correctval=iterdone, valname="iterdone", exact=True)
11-Sep-2019 22:12:43              if nmajordone != None:
11-Sep-2019 22:12:43 -                pstr += check_val( val=ret['nmajordone'], correctval=nmajordone, valname="nmajordone", exact=True )
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +                pstr += check_val(val=ret['nmajordone'], correctval=nmajordone, valname="nmajordone", exact=True)
11-Sep-2019 22:12:43          except Exception as e:
11-Sep-2019 22:12:43              logging.info(ret)
11-Sep-2019 22:12:43              raise
11-Sep-2019 22:12:43      logging.info("Epsilon: {}".format(epsilon))
11-Sep-2019 22:12:43      pstr += check_imexist(imgexist)
11-Sep-2019 22:12:43      pstr += check_imexistnot(imgexistnot)
11-Sep-2019 22:12:43 -    pstr += check_imval(imgval,epsilon=epsilon)
11-Sep-2019 22:12:43 -    pstr += check_imvalexact(imgvalexact,epsilon=epsilon)
11-Sep-2019 22:12:43 +    pstr += check_imval(imgval, epsilon=epsilon)
11-Sep-2019 22:12:43 +    pstr += check_imvalexact(imgvalexact, epsilon=epsilon)
11-Sep-2019 22:12:43      pstr += check_immask(imgmask)
11-Sep-2019 22:12:43      pstr += check_tabcache(tabcache)
11-Sep-2019 22:12:43 -    pstr += check_stopcode(stopcode)
11-Sep-2019 22:12:43 +    pstr += check_stopcode(stopcode, ret)
11-Sep-2019 22:12:43      pstr += check_reffreq(reffreq)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      return pstr
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 def check_final(pstr=""):
11-Sep-2019 22:12:43      if not isinstance(pstr, six.string_types):
11-Sep-2019 22:12:43          return False
11-Sep-2019 22:12:43 -    casalog.post(pstr,'INFO')
11-Sep-2019 22:12:43 -    if( pstr.count("Fail") > 0 ):
11-Sep-2019 22:12:43 +    casalog.post(pstr, 'INFO')
11-Sep-2019 22:12:43 +    if pstr.count("Fail") > 0:
11-Sep-2019 22:12:43          return False
11-Sep-2019 22:12:43      return True
11-Sep-2019 22:12:43 +
11-Sep-2019 22:12:43 ############################################################################################
11-Sep-2019 22:12:43 ##################################       Decorators       ##################################
11-Sep-2019 22:12:43 ############################################################################################
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 #import casaTestHelper
11-Sep-2019 22:12:43 #@casaTestHelper.skipIfMissingModule
11-Sep-2019 22:12:43 -def skipIfMissingModule(required_module,strict=False):
11-Sep-2019 22:12:43 +def skipIfMissingModule(required_module, strict=False):
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43 -    Decorator: skip test if specified module is not avaliable
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +    Decorator: skip test if specified module is not avaliable
11-Sep-2019 22:12:43      Example:
11-Sep-2019 22:12:43          @casaTestHelper.skipIfMissingModule('astropy')
11-Sep-2019 22:12:43          def test_test(self):
11-Sep-2019 22:12:43      '''
11-Sep-2019 22:12:43 -    import os
11-Sep-2019 22:12:43      try:
11-Sep-2019 22:12:43          __import__(required_module)
11-Sep-2019 22:12:43          flag = True
11-Sep-2019 22:12:43      except ImportError:
11-Sep-2019 22:12:43          flag = False
11-Sep-2019 22:12:43      def deco(function):
11-Sep-2019 22:12:43 -        if not CASA6:
11-Sep-2019 22:12:43 +        if not casa6:
11-Sep-2019 22:12:43              return deco
11-Sep-2019 22:12:43 -       
11-Sep-2019 22:12:43          def wrapper(self, *args, **kwargs):
11-Sep-2019 22:12:43              if not flag:
11-Sep-2019 22:12:43                  # If there is a strict flag run the tests as normal
11-Sep-2019 22:12:43                  print(sys.argv)
11-Sep-2019 22:12:43                  if strict:
11-Sep-2019 22:12:43                      function(self)
11-Sep-2019 22:12:43 -                    pass
11-Sep-2019 22:12:43                  else:
11-Sep-2019 22:12:43                      # Module ImportError and no strict flag
11-Sep-2019 22:12:43                      self.skipTest("ModuleNotFoundError: No module named '{}'".format(required_module))
11-Sep-2019 22:12:43 @@ -1820,14 +1643,10 @@ def skipIfMissingModule(required_module,strict=False):
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 #import casaTestHelper
11-Sep-2019 22:12:43 #@casaTestHelper.time_execution
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43 def time_execution(out_dict):
11-Sep-2019 22:12:43 -    # TODO Ver if this is the better option
11-Sep-2019 22:12:43      def time_decorator(function):
11-Sep-2019 22:12:43          '''
11-Sep-2019 22:12:43 -        Decorator: time execution of test
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 +        Decorator: time execution of test
11-Sep-2019 22:12:43          Example:
11-Sep-2019 22:12:43              @casaTestHelper.time_execution
11-Sep-2019 22:12:43              def test_test(self):
11-Sep-2019 22:12:43 @@ -1836,18 +1655,21 @@ def time_execution(out_dict):
11-Sep-2019 22:12:43          def function_timer(*args, **kwargs):
11-Sep-2019 22:12:43              failed = False
11-Sep-2019 22:12:43              result = None
11-Sep-2019 22:12:43 +            out_dict[function.__name__] = {}
11-Sep-2019 22:12:43 +            out_dict[function.__name__]['description'] = "An unexpected exception was raised"
11-Sep-2019 22:12:43 +            out_dict[function.__name__]['taskcall'] = ["An unexpected exception was raised by the test case"]
11-Sep-2019 22:12:43 +            out_dict[function.__name__]['rerun'] = "An unexpected exception was raised by the test case"
11-Sep-2019 22:12:43              t0 = time.time()
11-Sep-2019 22:12:43 -            print(out_dict)
11-Sep-2019 22:12:43              try:
11-Sep-2019 22:12:43                  result = function(*args, **kwargs)
11-Sep-2019 22:12:43 -            except:
11-Sep-2019 22:12:43 -                failed=True
11-Sep-2019 22:12:43 +            except Exception as e:
11-Sep-2019 22:12:43 +                failed = True
11-Sep-2019 22:12:43                  t1 = time.time()
11-Sep-2019 22:12:43                  out_dict[function.__name__]['runtime'] = t1-t0
11-Sep-2019 22:12:43                  casalog.post("Total time running {}: {} seconds".format(function.__name__, str(t1-t0)))
11-Sep-2019 22:12:43 -                #out_dict[function.__name__]['status'] = False
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['status'] = False
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['Failure Message'] = e
11-Sep-2019 22:12:43                  raise
11-Sep-2019 22:12:43 -               
11-Sep-2019 22:12:43              t1 = time.time()
11-Sep-2019 22:12:43              #print ("Total time running %s: %s seconds" % (function.__name__, str(t1-t0)))
11-Sep-2019 22:12:43              casalog.post("Total time running {}: {} seconds".format(function.__name__, str(t1-t0)))
11-Sep-2019 22:12:43 @@ -1855,18 +1677,15 @@ def time_execution(out_dict):
11-Sep-2019 22:12:43              #print(function.__name__)
11-Sep-2019 22:12:43              out_dict[function.__name__]['runtime'] = t1-t0
11-Sep-2019 22:12:43              out_dict[function.__name__]['status'] = True
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43              return result
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43          return function_timer
11-Sep-2019 22:12:43      return time_decorator
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43 +
11-Sep-2019 22:12:43 def cpu_usage(out_dict):
11-Sep-2019 22:12:43      def cpu_decorator(function):
11-Sep-2019 22:12:43          @wraps(function)
11-Sep-2019 22:12:43          def function_usage(*args, **kwargs):
11-Sep-2019 22:12:43              #Temp Fix : CASA 5 Doesnt Have psutil by default
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43              try:
11-Sep-2019 22:12:43                  import psutil
11-Sep-2019 22:12:43                  use_psutil = True
11-Sep-2019 22:12:43 @@ -1877,37 +1696,32 @@ def cpu_usage(out_dict):
11-Sep-2019 22:12:43                  snapshot1 = process.memory_info()
11-Sep-2019 22:12:43                  open_files1 = process.open_files()
11-Sep-2019 22:12:43                  num_file_descriptors1 = process.num_fds()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  #print ("Function: {}, {} MBs".format(function.__name__, megs1))
11-Sep-2019 22:12:43                  #print ("Function: {}, Open Files: {}".format(function.__name__, open_files1))
11-Sep-2019 22:12:43                  #print ("Function: {}, num_file_descriptors: {}".format(function.__name__, num_file_descriptors1))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  result = function(*args, **kwargs)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  process = psutil.Process(os.getpid())
11-Sep-2019 22:12:43                  snapshot2 = process.memory_info()
11-Sep-2019 22:12:43                  open_files2 = process.open_files()
11-Sep-2019 22:12:43                  num_file_descriptors2 = process.num_fds()
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  #print ("Function: {}, {} MBs".format(function.__name__, megs2))
11-Sep-2019 22:12:43                  #print ("Function: {}, Open Files: {}".format(function.__name__, open_files2))
11-Sep-2019 22:12:43                  #print ("Function: {}, num_file_descriptors: {}".format(function.__name__, num_file_descriptors2))
11-Sep-2019 22:12:43                  #print('{:.2f} MB\n'.format(process.memory_info().rss / 1024 / 1024))
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  #print ("Total Mem Info { }: {:.2f} MB".format(function.__name__,(process.memory_info().rss) / 1024 / 1024 ))
11-Sep-2019 22:12:43 -                out_dict[function.__name__]['cpu_usage'] = {    "number of file descriptors opened" :  num_file_descriptors2 - num_file_descriptors1,
11-Sep-2019 22:12:43 -                                                                "Open files" : open_files2,
11-Sep-2019 22:12:43 -                                                                "Pre Memory Snapshot (bytes)" : snapshot1,
11-Sep-2019 22:12:43 -                                                                "Post Memory Snapshot (bytes)" : snapshot2
11-Sep-2019 22:12:43 -                                                        }
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['cpu_usage'] = {"number of file descriptors opened" :  num_file_descriptors2 - num_file_descriptors1,
11-Sep-2019 22:12:43 +                                                            "Open files" : open_files2,
11-Sep-2019 22:12:43 +                                                            "Pre Memory Snapshot (bytes)" : snapshot1,
11-Sep-2019 22:12:43 +                                                            "Post Memory Snapshot (bytes)" : snapshot2
11-Sep-2019 22:12:43 +                                                           }
11-Sep-2019 22:12:43              else:
11-Sep-2019 22:12:43                  #TODO: Add methods to get mem snapshots when psutils is not available
11-Sep-2019 22:12:43                  result = function(*args, **kwargs)
11-Sep-2019 22:12:43 -                out_dict[function.__name__]['cpu_usage'] = {    "number of file descriptors opened" : "Unknown",
11-Sep-2019 22:12:43 -                                                                "Open files" : "Unknown",
11-Sep-2019 22:12:43 -                                                                "Pre Memory Snapshot (bytes)" : "Unknown",
11-Sep-2019 22:12:43 -                                                                "Post Memory Snapshot (bytes)" : "Unknown"
11-Sep-2019 22:12:43 -                                                        }
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['cpu_usage'] = {"number of file descriptors opened" : "Unknown",
11-Sep-2019 22:12:43 +                                                            "Open files" : "Unknown",
11-Sep-2019 22:12:43 +                                                            "Pre Memory Snapshot (bytes)" : "Unknown",
11-Sep-2019 22:12:43 +                                                            "Post Memory Snapshot (bytes)" : "Unknown"
11-Sep-2019 22:12:43 +                                                           }
11-Sep-2019 22:12:43              return result
11-Sep-2019 22:12:43          return function_usage
11-Sep-2019 22:12:43      return cpu_decorator
11-Sep-2019 22:12:43 @@ -1915,53 +1729,45 @@ def cpu_usage(out_dict):
11-Sep-2019 22:12:43 def peakmem(out_dict):
11-Sep-2019 22:12:43      #TODO: https://pytracemalloc.readthedocs.io/examples.html
11-Sep-2019 22:12:43      ### NOTE: Only for python3.4+
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43      def mem_decorator(function):
11-Sep-2019 22:12:43          @wraps(function)
11-Sep-2019 22:12:43          def function_mem(*args, **kwargs):
11-Sep-2019 22:12:43 -            import sys
11-Sep-2019 22:12:43 -            if (sys.version_info > (3, 3)):
11-Sep-2019 22:12:43 +            if sys.version_info > (3, 3):
11-Sep-2019 22:12:43                  import tracemalloc
11-Sep-2019 22:12:43                  tracemalloc.clear_traces()
11-Sep-2019 22:12:43                  tracemalloc.start()
11-Sep-2019 22:12:43                  snapshot1 = tracemalloc.take_snapshot() # Snapshot of traces of memory blocks allocated by Python.
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  result = function(*args, **kwargs)
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43                  snapshot2 = tracemalloc.take_snapshot()
11-Sep-2019 22:12:43 -                peakmem = ("{} MiB".format(tracemalloc.get_traced_memory()[1] / 1024 /1024)) #Get the current size and peak size of memory blocks traced by the tracemalloc module as a tuple: (current: int, peak: int)
11-Sep-2019 22:12:43 +                peak_traced_memory = ("{} MiB".format(tracemalloc.get_traced_memory()[1] / 1024 /1024)) #Get the current size and peak size of memory blocks traced by the tracemalloc module as a tuple: (current: int, peak: int)
11-Sep-2019 22:12:43                  tracemalloc.stop()
11-Sep-2019 22:12:43                  top_stats = snapshot2.compare_to(snapshot1, 'lineno') # Compute the differences with an old snapshot.
11-Sep-2019 22:12:43 -                out_dict[function.__name__]['peakmem'] = peakmem
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['peakmem'] = peak_traced_memory
11-Sep-2019 22:12:43                  out_dict[function.__name__]['memleaks'] = top_stats[:10] #
11-Sep-2019 22:12:43              else:
11-Sep-2019 22:12:43                  result = function(*args, **kwargs)
11-Sep-2019 22:12:43 -                out_dict[function.__name__]['peakmem'] =  "Unknown"
11-Sep-2019 22:12:43 -                out_dict[function.__name__]['memleaks'] =  "Unknown" #
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['peakmem'] = "Unknown"
11-Sep-2019 22:12:43 +                out_dict[function.__name__]['memleaks'] = "Unknown" #
11-Sep-2019 22:12:43              return result
11-Sep-2019 22:12:43          return function_mem
11-Sep-2019 22:12:43      return mem_decorator
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43 +
11-Sep-2019 22:12:43 def mem_use_deco(out_dict):
11-Sep-2019 22:12:43      def mem_decorator(function):
11-Sep-2019 22:12:43          @wraps(function)
11-Sep-2019 22:12:43          def function_mem(*args, **kwargs):
11-Sep-2019 22:12:43 -            out = subprocess.Popen(['ps','v','-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].split(b'\n')
11-Sep-2019 22:12:43 +            out = subprocess.Popen(['ps', 'v', '-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].split(b'\n')
11-Sep-2019 22:12:43              vsz_index = out[0].split().index(b'RSS')
11-Sep-2019 22:12:43              out_start = float(out[1].split()[vsz_index]) / 1024
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43              result = function(*args, **kwargs)
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43 -            out = subprocess.Popen(['ps','v','-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].split(b'\n')
11-Sep-2019 22:12:43 +            out = subprocess.Popen(['ps', 'v', '-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].split(b'\n')
11-Sep-2019 22:12:43              vsz_index = out[0].split().index(b'RSS')
11-Sep-2019 22:12:43              out_end = float(out[1].split()[vsz_index]) / 1024
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43              out_dict[function.__name__]['Mem Use'] = "{} MiB".format(out_end-out_start)
11-Sep-2019 22:12:43 -           
11-Sep-2019 22:12:43              return result
11-Sep-2019 22:12:43          return function_mem
11-Sep-2019 22:12:43      return mem_decorator
11-Sep-2019 22:12:43 -   
11-Sep-2019 22:12:43 +
11-Sep-2019 22:12:43 def stats_dict(out_dict):
11-Sep-2019 22:12:43      def stats_decorator(function):
11-Sep-2019 22:12:43          @time_execution(out_dict)
11-Sep-2019 22:12:43 @@ -1973,6 +1779,3 @@ def stats_dict(out_dict):
11-Sep-2019 22:12:43              return function(*args, **kwargs)
11-Sep-2019 22:12:43          return all_wrapped
11-Sep-2019 22:12:43      return stats_decorator
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 -
11-Sep-2019 22:12:43 Argument values:
11-Sep-2019 22:12:43 casatasks
11-Sep-2019 22:12:43 /export/home/cbt-el7-6/bamboohome/xml-data/build-dir/CASA-CTB-JOB1/casatasks
11-Sep-2019 22:12:43 master
11-Sep-2019 22:12:43 None
11-Sep-2019 22:12:43 Last Tag: 2019.147
11-Sep-2019 22:12:43 New Tag: 2019.148
11-Sep-2019 22:12:43 Creating a new tag
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 None
11-Sep-2019 22:12:43 Push enabled. Pushing new tag upstream.
11-Sep-2019 22:12:43 To ssh://git@open-bitbucket.nrao.edu:7999/casa/casatasks.git
11-Sep-2019 22:12:43 * [new tag]         2019.148 -> 2019.148
11-Sep-2019 22:12:43
11-Sep-2019 22:12:43 None
11-Sep-2019 22:12:43 Finished task 'Create wheel' with result: Success
11-Sep-2019 22:12:43 Running post build plugin 'Docker Container Cleanup'
11-Sep-2019 22:12:44
Beginning to execute external process for build 'CASA - Casa6 Tasks Wheel Build - Build and Package RHEL6 #142 (CASA-CTB-JOB1-142)'
... running command line:
/bin/docker rm -f task-wheel-container
... in: /export/home/cbt-el7-6/bamboohome/xml-data/build-dir/CASA-CTB-JOB1
11-Sep-2019 22:12:45 task-wheel-container
11-Sep-2019 22:12:45 Running post build plugin 'NCover Results Collector'
11-Sep-2019 22:12:45 Running post build plugin 'Clover Results Collector'
11-Sep-2019 22:12:45 Running post build plugin 'npm Cache Cleanup'
11-Sep-2019 22:12:45 Running post build plugin 'Artifact Copier'
11-Sep-2019 22:12:45 Publishing an artifact: EL6 wheel
11-Sep-2019 22:12:45 Finished publishing of artifact Non required shared artifact: [EL6 wheel], pattern: [*-any.whl] anchored at: [wheeldirectory/] in 271.8 ms
11-Sep-2019 22:12:45 Finalising the build...
11-Sep-2019 22:12:45 Stopping timer.
11-Sep-2019 22:12:45 Build CASA-CTB-JOB1-142 completed.
11-Sep-2019 22:12:45 Running on server: post build plugin 'NCover Results Collector'
11-Sep-2019 22:12:45 Running on server: post build plugin 'Build Hanging Detection Configuration'
11-Sep-2019 22:12:45 Running on server: post build plugin 'Clover Delta Calculator'
11-Sep-2019 22:12:45 Running on server: post build plugin 'Maven Dependencies Postprocessor'
11-Sep-2019 22:12:45 All post build plugins have finished
11-Sep-2019 22:12:45 Generating build results summary...
11-Sep-2019 22:12:45 Saving build results to disk...
11-Sep-2019 22:12:46 Logging substituted variables...
11-Sep-2019 22:12:46 Indexing build results...
11-Sep-2019 22:12:46 Finished building CASA-CTB-JOB1-142.