Exemplo n.º 1
0
  def get(self):
    xpeditePath = os.path.normpath(os.path.join(__file__, '../../../../lib'))
    sys.path.append(xpeditePath)

    from xpedite.jupyter import buildXpdName
    from xpedite.jupyter.xpediteData import XpediteDataReader
    from xpedite.jupyter.context import Context

    try:
      action = self.get_argument('action', None)
      reportKey = self.get_argument('reportKey', None)
      assert reportKey is not None
      xpdFileName = buildXpdName(self.get_argument(Context.fileKey, None))
      assert xpdFileName is not None
      xpDataPath = os.path.join(Context.xpediteDataPath, xpdFileName)
      with XpediteDataReader(xpDataPath) as xpd:
        data = xpd.getData(reportKey)
        markupGz = base64.b64decode(data)
        self.set_header("Content-type", 'text/html')
        self.set_header("Content-Encoding", 'gzip')
        self.finish(markupGz)
    except IOError:
      ioErr = 'Could not read html content from nbPath parameter. Check if file exists.'
      self.finish(ioErr)
      print(ioErr)
    except AssertionError as e:
      assertErr = 'Fatal error - The request is missing mandatory query parameters.'
      self.finish(assertErr)
      print(assertErr)
Exemplo n.º 2
0
  def get(self):
    xpeditePath = os.path.normpath(os.path.join(__file__, '../../../../../..'))
    sys.path.append(xpeditePath)

    from xpedite.jupyter.xpediteData import XpediteDataReader
    from xpedite.jupyter.context import Context

    try:
      action = self.get_argument('action', None)
      reportKey = self.get_argument('reportKey', None)
      assert reportKey is not None
      notebookPath = self.get_argument(Context.notebookPathKey, None)
      assert notebookPath is not None
      xpdFilePath = Context.buildXpdPath(notebookPath)
      with XpediteDataReader(xpdFilePath) as xpd:
        data = xpd.getData(reportKey)
        markupGz = base64.b64decode(data)
        self.set_header("Content-type", 'text/html')
        self.set_header("Content-Encoding", 'gzip')
        self.finish(markupGz)
    except IOError:
      ioErr = 'Could not read html from xpd file - {} with key - {}'.format(xpdFilePath, reportKey)
      self.finish(ioErr)
      print(ioErr)
    except AssertionError as e:
      assertErr = 'Fatal error - The request is missing mandatory query parameters.'
      self.finish(assertErr)
      print(assertErr)
Exemplo n.º 3
0
def loadBaseline():
    """
  Load a baseline .xpd file generated when a Jupyter notebook is built
  to compare to profile information from test record and report runs
  """
    from xpedite.jupyter.xpediteData import XpediteDataReader
    baselineProfileFile = os.path.join(dataDir, 'baseline.xpd')
    with XpediteDataReader(baselineProfileFile) as xpediteDataReader:
        profiles = xpediteDataReader.getData('profiles')
    return profiles
Exemplo n.º 4
0
 def __init__(self, dataDir):
   """
   Load files with expected results for comparison
   """
   import six.moves.cPickle as pickle
   from xpedite.jupyter.xpediteData    import XpediteDataReader
   with open(os.path.join(dataDir, PROBE_CMD_BASELINE_PATH), 'rb') as probeFileHandle:
     self.baselineProbeMap = pickle.load(probeFileHandle) # pylint: disable=c-extension-no-member
   with XpediteDataReader(os.path.join(dataDir, REPORT_CMD_BASELINE_PATH)) as xpediteDataReader:
     self.baselineProfiles = xpediteDataReader.getData(PROFILES_KEY)
   self.baselineProfileInfo = loadProfileInfo(dataDir, GENERATE_CMD_BASELINE_PATH)
Exemplo n.º 5
0
 def loadProfiles(self):
     """Load profile data from Xpedite data file"""
     from xpedite.jupyter.xpediteData import XpediteDataReader
     with XpediteDataReader(self.dataFile) as xpd:
         profiles = xpd.getData(PROFILES_KEY)
     return profiles