def __sendErrorAsImg(self, msgText, fileHelper):
   retVal = generateErrorMessagePlot(msgText)
   retVal = fileHelper.sendData(retVal['Value'])
   if not retVal['OK']:
     return retVal
   fileHelper.sendEOF()
   return S_OK()
Exemple #2
0
    def __sendErrorAsImg(self, msgText, fileHelper):
        """
        In case of an error message a white plot is created with the error message.
        """

        fileHelper.sendData(generateErrorMessagePlot(msgText))
        fileHelper.sendEOF()
 def __sendErrorAsImg( self, msgText, fileHelper ):
   retVal = generateErrorMessagePlot( msgText )
   retVal = fileHelper.sendData( retVal[ 'Value' ] )
   if not retVal[ 'OK' ]:
     return retVal
   fileHelper.sendEOF()
   return S_OK()
Exemple #4
0
def test_error():
    """
    Test error message plot
    """

    res = generateErrorMessagePlot("testing error message")
    with open(filename, "wb") as out:
        out.write(res)

    res = compare(filename, os.path.join(plots_directory, "error.png"))
    assert res == 0.0
Exemple #5
0
def test_error():
    """
  Test error message plot
  """

    res = generateErrorMessagePlot("testing error message")
    assert res['OK'] is True
    with open(filename, 'wb') as out:
        out.write(res['Value'])

    res = compare(filename, os.path.join(plots_directory, 'error.png'))
    assert res == 0.0
Exemple #6
0
  def __sendErrorAsImg( self, msgText, fileHelper ):
    """
    In case of an error message a whcite plot is created with the error message.
    """

    retVal = generateErrorMessagePlot( msgText )
    if not retVal:
      retVal = fileHelper.sendData( retVal[ 'Message' ] )
    else:
      retVal = fileHelper.sendData( retVal[ 'Value' ] )
      if not retVal[ 'OK' ]:
        return retVal
      fileHelper.sendEOF()
    return S_OK()
Exemple #7
0
  def __sendErrorAsImg(self, msgText, fileHelper):
    """
    In case of an error message a whcite plot is created with the error message.
    """

    retVal = generateErrorMessagePlot(msgText)
    if not retVal:
      retVal = fileHelper.sendData(retVal['Message'])
    else:
      retVal = fileHelper.sendData(retVal['Value'])
      if not retVal['OK']:
        return retVal
      fileHelper.sendEOF()
    return S_OK()
Exemple #8
0
    def export_streamToClient(self, fileId):
        """
        Get graphs data

        :param str fileId: encoded plot attributes
        """

        # First check if we've got to generate the plot
        if len(fileId) > 5 and fileId[1] == ":":
            self.log.info(
                "Seems the file request is a plot generation request!")
            try:
                result = self._generatePlotFromFileId(fileId)
            except Exception as e:  # pylint: disable=broad-except
                self.log.exception("Exception while generating plot", str(e))
                result = S_ERROR("Error while generating plot: %s" % str(e))
            if not result["OK"]:
                return generateErrorMessagePlot(result["Message"])
            fileId = result["Value"]

        retVal = gDataCache.getPlotData(fileId)
        if not retVal["OK"]:
            return generateErrorMessagePlot(result["Message"])
        return retVal["Value"]
Exemple #9
0
 def __sendErrorAsImg(self, msgText, fileHelper):
     fileHelper.sendData(generateErrorMessagePlot(msgText))
     fileHelper.sendEOF()