How to use the dirac.lib.diset.getRPCClient function in DIRAC

To help you get started, we’ve selected a few DIRAC examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / production / ProductionRequest.py View on Github external
  @jsonify
  def bkk_tags(self):
    try:
      tag = str(request.params.get('tag', ''))
      tags = tag.split(':')
      RPC = getRPCClient('Bookkeeping/BookkeepingManager')
      result = RPC.getAvailableTags()
      if not result['OK']:
        return result
      rows = [{'v':x[1]} for x in result['Value']['Records'] if x[0] in tags]
      return { 'OK':True, 'result':rows, 'total':len(rows) }
    except Exception, e:
      return S_ERROR('Could not get tags from BK (%s)' % str(e))
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / systems / configuration.py View on Github external
def __getRemoteConfiguration( self ):
    rpcClient = getRPCClient( gConfig.getValue( "/DIRAC/Configuration/MasterServer", "Configuration/Server" ) )
    modCfg = Modificator( rpcClient )
    retVal = modCfg.loadFromRemote()
    if retVal[ 'OK' ]:
      session[ 'cfgData' ] = str( modCfg )
      session[ 'csName' ] = "%s Configuration" % ( modCfg.getValue( "/DIRAC/VirtualOrganization" ) )
      session.save()
      c.cfgData = modCfg.cfgData
      c.csName = session[ 'csName' ]
    return retVal
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / systems / monitoring.py View on Github external
def deleteView( self ):
    """
    Delete a view
    """
    if not authorizeAction():
      return render( "/error.mako" )
    if not 'id' in request.params:
      c.error = "Missing view id to delete!"
      return render( "/error.mako" )
    try:
      id = int( request.params[ 'id' ] )
    except Exception, e:
      c.error = "View id is not valid"
      return render( "/error.mako" )
    rpcClient = getRPCClient( "Monitoring/Server" )
    retVal = rpcClient.deleteView( id )
    if not retVal[ 'OK' ]:
      c.error = "Error while deleting view %s" % retVal[ 'Message' ]
      return render( "/error.mako" )
    return redirect_to( 'manageViews' )
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / JobMonitor.py View on Github external
def __getStagerReport(self,id):
    RPC = getRPCClient("WorkloadManagement/JobMonitoring")
    result = RPC.getJobParameters(id)
    if result["OK"]:
      attr = result["Value"]
      c.result = []
      if attr.has_key("StagerReport"):
        c.result =  attr["StagerReport"]
        c.result = {"success":"true","result":c.result}
      else:
        c.result = {"success":"false","error":"StagerReport not available"}
    else:
      c.result = {"success":"false","error":result["Message"]}
    gLogger.info("getStagerReport:",id)
    return c.result
################################################################################
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / JobMonitor.py View on Github external
group = credentials.getSelectedGroup()
    user = str(credentials.getUsername())
    if len(request.params) > 0:
      tmp = {}
      for i in request.params:
        tmp[i] = str(request.params[i])
      callback["extra"] = tmp
      if callback["extra"].has_key("prod"):
        callback["extra"]["prod"] = callback["extra"]["prod"].zfill(8)
        if callback["extra"]["prod"] == "00000000":
          callback["extra"]["prod"] = ""
      gLogger.info(" - ",callback["extra"])
    if user == "Anonymous":
      callback["prod"] = [["Insufficient rights"]]
    else:
      RPC = getRPCClient("WorkloadManagement/JobMonitoring")
      result = RPC.getProductionIds()
      if result["OK"]:
        prod = []
        prods = result["Value"]
        if len(prods)>0:
          prod.append([str("All")])
          tmp = []
          for keys in prods:
            try:
              id = str(int(keys)).zfill(8)
            except:
              id = str(keys)
            tmp.append(str(id))
          tmp.sort(reverse=True)
          for i in tmp:
            prod.append([str(i)])
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / ProductionMonitor.py View on Github external
def __dataQuery(self,prodid):
    id = int(prodid)
    RPC = getRPCClient("Transformation/TransformationManager")
    res = RPC.getTransformationInputDataQuery(id)
    gLogger.info("-= #######",res)
    if not res['OK']:
      c.result = {"success":"false","error":res["Message"]}
    else:
      result = res["Value"]
      back = []
      for i in sortList(result.keys()):
        back.append([i,result[i]])
      c.result = {"success":"true","result":back}
    return c.result
################################################################################
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / data / RunDBMonitor.py View on Github external
def display(self):
    RPC = getRPCClient(self.gatewayURL)
    result = RPC.ping()
    gLogger.info(" - P I N G - ",result)
    c.select = self.__getSelectionData()
    return render("data/RunDBMonitor.mako")
################################################################################
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / production / ProductionWorkflow.py View on Github external
name = req["Name"]
        new_name = req["NewName"]
        path = req["Path"]
      except Exception,msg:
        return S_ERROR(msg)
      if name == new_name:
        return S_ERROR("You can't use the same workflow name")
      result = self.__getWorkflow(name)
      if not result["OK"]:
        return result
      wf = fromXMLString(result['Value'])
      wf.setName(new_name)
      wf.setType(path)
      try:
        wfxml = wf.toXML()
        RPC = getRPCClient("ProductionManagement/ProductionManager")
        result = RPC.publishWorkflow(str(wfxml),True)
      except Exception,msg:
        return S_ERROR(msg)
      if not result['OK']:
        return result
      return S_OK("Moved")
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / JobMonitor.py View on Github external
def __globalStat(self):
    RPC = getRPCClient("WorkloadManagement/JobMonitoring")
    result = RPC.getJobPageSummaryWeb({},globalSort,0,1,False)
    gLogger.info(" - result - :",result)
    if result["OK"]:
      result = result["Value"]
      if result.has_key("Extras"):
        extra = result["Extras"]
        back = []
        for i in sortList(extra.keys()):
          back.append([i,extra[i]])
        return back
################################################################################
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / info / general.py View on Github external
    ntc = NotificationClient( lambda x , timeout: getRPCClient( x , timeout = timeout , static = True ) )