Example #1
0
def initializePlottingHandler( serviceInfo ):

  #Get data location
  plottingSection = PathFinder.getServiceSection( "Framework/Plotting" )
  dataPath = gConfig.getValue( "%s/DataLocation" % plottingSection, "data/graphs" )
  dataPath = dataPath.strip()
  if "/" != dataPath[0]:
    dataPath = os.path.realpath( "%s/%s" % ( gConfig.getValue( '/LocalSite/InstancePath', rootPath ), dataPath ) )
  gLogger.info( "Data will be written into %s" % dataPath )
  try:
    os.makedirs( dataPath )
  except:
    pass
  try:
    testFile = "%s/plot__.test" % dataPath
    fd = file( testFile, "w" )
    fd.close()
    os.unlink( testFile )
  except IOError:
    gLogger.fatal( "Can't write to %s" % dataPath )
    return S_ERROR( "Data location is not writable" )

  gPlotCache.setPlotsLocation( dataPath )
  gMonitor.registerActivity( "plotsDrawn", "Drawn plot images", "Plotting requests", "plots", gMonitor.OP_SUM )
  return S_OK()
Example #2
0
def initializePlottingHandler(serviceInfo):

    #Get data location
    plottingSection = PathFinder.getServiceSection("Framework/Plotting")
    dataPath = gConfig.getValue("%s/DataLocation" % plottingSection,
                                "data/graphs")
    dataPath = dataPath.strip()
    if "/" != dataPath[0]:
        dataPath = os.path.realpath(
            "%s/%s" %
            (gConfig.getValue('/LocalSite/InstancePath', rootPath), dataPath))
    gLogger.info("Data will be written into %s" % dataPath)
    try:
        os.makedirs(dataPath)
    except:
        pass
    try:
        testFile = "%s/plot__.test" % dataPath
        fd = file(testFile, "w")
        fd.close()
        os.unlink(testFile)
    except IOError:
        gLogger.fatal("Can't write to %s" % dataPath)
        return S_ERROR("Data location is not writable")

    gPlotCache.setPlotsLocation(dataPath)
    gMonitor.registerActivity("plotsDrawn", "Drawn plot images",
                              "Plotting requests", "plots", gMonitor.OP_SUM)
    return S_OK()