DiracAdmin

DIRAC Administrator API Class

All administrative functionality is exposed through the DIRAC Admin API. Examples include site banning and unbanning, WMS proxy uploading etc.

class DIRAC.Interfaces.API.DiracAdmin.DiracAdmin

Bases: DIRAC.Core.Base.API.API

Administrative functionalities

__init__()

Internal initialization of the DIRAC Admin API.

allowSite(site, comment, printOutput=False)

Adds the site to the site mask.

Example usage:

>>> print diracAdmin.allowSite()
{'OK': True, 'Value': }
Returns:S_OK,S_ERROR
banSite(site, comment, printOutput=False)

Removes the site from the site mask.

Example usage:

>>> print diracAdmin.banSite()
{'OK': True, 'Value': }
Returns:S_OK,S_ERROR
checkProxyUploaded(userDN, userGroup, requiredTime)

Set the persistence of a proxy in the Proxy Manager

Example usage:

>>> print diracAdmin.setProxyPersistency( 'some DN', 'dirac group', True )
{'OK': True, 'Value' : True/False }
Parameters:
  • userDN (string) – User DN
  • userGroup (string) – DIRAC Group
  • requiredTime (boolean) – Required life time of the uploaded proxy
Returns:

S_OK,S_ERROR

clearMask()

Removes all sites from the site mask. Should be used with care.

Example usage:

>>> print diracAdmin.clearMask()
{'OK': True, 'Value':''}
Returns:S_OK,S_ERROR
csCommitChanges(sortUsers=True)

Commit the changes in the CS

csDeleteUser(user)

Deletes a user from the CS. Can take a list of users

csDescribeGroups(mask=False)

List groups and their properties in the CS. If a mask is given, only groups in the mask will be returned

csDescribeHosts(mask=False)

Gets extended info for the hosts in the CS

csDescribeUsers(mask=False)

List users and their properties in the CS. If a mask is given, only users in the mask will be returned

csListGroups()

Lists groups in the CS

csListHosts()

Lists the hosts in the CS

csListUsers(group=False)

Lists the users in the CS. If no group is specified return all users.

csModifyGroup(groupname, properties, createIfNonExistant=False)

Modify a user in the CS. Takes the same params as in addGroup and applies the changes

csModifyHost(hostname, properties, createIfNonExistant=False)

Modify a host in the CS. Takes the same params as in addHost and applies the changes

csModifyUser(username, properties, createIfNonExistant=False)

Modify a user in the CS. Takes the same params as in addUser and applies the changes

csModifyValue(optionPath, newValue)

Function to modify an existing value in the CS.

csRegisterUser(username, properties)

Registers a user in the CS.

  • username: Username of the user (easy;)
  • properties: Dict containing:
    • DN
    • groups : list/tuple of groups the user belongs to
    • <others> : More properties of the user, like mail
csSetOption(optionPath, optionValue)

Function to modify an existing value in the CS.

csSetOptionComment(optionPath, comment)

Function to modify an existing value in the CS.

csSyncUsersWithCFG(usersCFG)

Synchronize users in cfg with its contents

getBDIICE(ce, host=None)

Get information about ce from BDII at host

getBDIICEState(ce, useVO='', host=None)

Get information about ce state from BDII at host

getBDIICEVOView(ce, useVO='', host=None)

Get information about ce voview from BDII at host

getBDIICluster(ce, host=None)

Get information about ce from BDII at host

getBDIISE(site, useVO='', host=None)

Get information about SA from BDII at host

getBDIIService(ce, host=None)

Get information about ce from BDII at host

getBDIISite(site, host=None)

Get information about site from BDII at host

getBannedSites(printOutput=False)

Retrieve current list of banned and probing sites.

Example usage:

>>> print diracAdmin.getBannedSites()
{'OK': True, 'Value': []}
Returns:S_OK,S_ERROR
getExternalPackageVersions()

Simple function that attempts to obtain the external versions for the local DIRAC installation (frequently needed for debugging purposes).

getJobPilotOutput(jobID, directory='')

Retrieve the pilot output for an existing job in the WMS. The output will be retrieved in a local directory unless otherwise specified.

>>> print dirac.getJobPilotOutput(12345)
{'OK': True, StdOut:'',StdError:''}
Parameters:job (integer or string) – JobID
Returns:S_OK,S_ERROR
getJobPilots(jobID)

Extract the list of submitted pilots and their status for a given jobID from the WMS. Useful information is printed to the screen.

>>> print dirac.getJobPilots()
{'OK': True, 'Value': {PilotID:{StatusDict}}}
Parameters:job (integer or string) – JobID
Returns:S_OK,S_ERROR
getPilotInfo(gridReference)

Retrieve info relative to a pilot reference

>>> print dirac.getPilotInfo(12345)
{'OK': True, 'Value': {}}
Parameters:gridReference (string) – Pilot Job Reference
Returns:S_OK,S_ERROR
getPilotLoggingInfo(gridReference)

Retrieve the pilot logging info for an existing job in the WMS.

>>> print dirac.getPilotLoggingInfo(12345)
{'OK': True, 'Value': {"The output of the command"}}
Parameters:gridReference (string) – Gridp pilot job reference Id
Returns:S_OK,S_ERROR
getPilotOutput(gridReference, directory='')

Retrieve the pilot output (std.out and std.err) for an existing job in the WMS.

>>> print dirac.getJobPilotOutput(12345)
{'OK': True, 'Value': {}}
Parameters:job (integer or string) – JobID
Returns:S_OK,S_ERROR
getPilotProxy(userDN, userGroup, validity=43200)

Retrieves a pilot proxy with default 12hr validity and stores this in a file in the local directory by default.

Example usage:

>>> print diracAdmin.getVOMSProxy()
{'OK': True, 'Value': }
Returns:S_OK,S_ERROR
getPilotSummary(startDate='', endDate='')

Retrieve the pilot output for an existing job in the WMS. Summary is printed at INFO level, full dictionary of results also returned.

>>> print dirac.getPilotSummary()
{'OK': True, 'Value': {CE:{Status:Count}}}
Parameters:job (integer or string) – JobID
Returns:S_OK,S_ERROR
getProxy(userDN, userGroup, validity=43200, limited=False)

Retrieves a proxy with default 12hr validity and stores this in a file in the local directory by default.

Example usage:

>>> print diracAdmin.getProxy()
{'OK': True, 'Value': }
Returns:S_OK,S_ERROR
getRequestSummary(printOutput=False)

Get a summary of the requests in the request DB.

getServicePorts(setup='', printOutput=False)

Checks the service ports for the specified setup. If not given this is taken from the current installation (/DIRAC/Setup)

Example usage:

>>> print diracAdmin.getServicePorts()
{'OK': True, 'Value':''}
Returns:S_OK,S_ERROR
getSiteMask(printOutput=False, status='Active')

Retrieve current site mask from WMS Administrator service.

Example usage:

>>> print diracAdmin.getSiteMask()
{'OK': True, 'Value': 0L}
Returns:S_OK,S_ERROR
getSiteMaskLogging(site=None, printOutput=False)

Retrieves site mask logging information.

Example usage:

>>> print diracAdmin.getSiteMaskLogging('LCG.AUVER.fr')
{'OK': True, 'Value': }
Returns:S_OK,S_ERROR
getSiteProtocols(site, printOutput=False)

Allows to check the defined protocols for each site SE.

getSiteSection(site, printOutput=False)

Simple utility to get the list of CEs for DIRAC site name.

Example usage:

>>> print diracAdmin.getSiteSection('LCG.CERN.ch')
{'OK': True, 'Value':}
Returns:S_OK,S_ERROR
getVOMSProxy(userDN, userGroup, vomsAttr=False, validity=43200, limited=False)

Retrieves a proxy with default 12hr validity and VOMS extensions and stores this in a file in the local directory by default.

Example usage:

>>> print diracAdmin.getVOMSProxy()
{'OK': True, 'Value': }
Returns:S_OK,S_ERROR
killPilot(gridReference)

Kill the pilot specified

>>> print dirac.getPilotInfo(12345)
{'OK': True, 'Value': {}}
Parameters:gridReference – Pilot Job Reference
Returns:S_OK,S_ERROR
resetJob(jobID)

Reset a job or list of jobs in the WMS. This operation resets the reschedule counter for a job or list of jobs and allows them to run as new.

Example:

>>> print dirac.reset(12345)
{'OK': True, 'Value': [12345]}
Parameters:job (integer or list of integers) – JobID
Returns:S_OK,S_ERROR
selectRequests(jobID=None, requestID=None, requestName=None, requestType=None, status=None, operation=None, ownerDN=None, ownerGroup=None, requestStart=0, limit=100, printOutput=False)

Select requests from the request management system. A few notes on the selection criteria:

  • jobID is the WMS JobID for the request (if applicable)
  • requestID is assigned during submission of the request
  • requestName is the corresponding XML file name
  • requestType e.g. ‘transfer’
  • status e.g. Done
  • operation e.g. replicateAndRegister
  • requestStart e.g. the first request to consider (start from 0 by default)
  • limit e.g. selection limit (default 100)
>>> dirac.selectRequests(jobID='4894')
{'OK': True, 'Value': [[<Requests>]]}
sendMail(address, subject, body, fromAddress=None, localAttempt=True, html=False)

Send mail to specified address with body.

sendSMS(userName, body, fromAddress=None)

Send mail to specified address with body.

setProxyPersistency(userDN, userGroup, persistent=True)

Set the persistence of a proxy in the Proxy Manager

Example usage:

>>> print diracAdmin.setProxyPersistency( 'some DN', 'dirac group', True )
{'OK': True }
Parameters:
  • userDN (string) – User DN
  • userGroup (string) – DIRAC Group
  • persistent (boolean) – Persistent flag
Returns:

S_OK,S_ERROR

setSiteProtocols(site, protocolsList, printOutput=False)

Allows to set the defined protocols for each SE for a given site.

uploadProxy(group)

Upload a proxy to the DIRAC WMS. This method

Example usage:

>>> print diracAdmin.uploadProxy('lhcb_pilot')
{'OK': True, 'Value': 0L}
Parameters:
  • group – DIRAC Group
  • permanent (boolean) – Indefinitely update proxy
Returns:

S_OK,S_ERROR