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:
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:
>>> gLogger.notice(diracAdmin.allowSite()) {'OK': True, 'Value': }
- Returns
S_OK,S_ERROR
- banSite(site, comment, printOutput=False)¶
Removes the site from the site mask.
Example usage:
>>> gLogger.notice(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:
>>> gLogger.notice(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
- 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
- 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:
>>> gLogger.notice(diracAdmin.getBannedSites()) {'OK': True, 'Value': []}
- Returns
S_OK,S_ERROR
- 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.
>>> gLogger.notice(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.
>>> gLogger.notice(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
>>> gLogger.notice(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.
>>> gLogger.notice(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.
>>> gLogger.notice(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:
>>> gLogger.notice(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.
>>> gLogger.notice(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:
>>> gLogger.notice(diracAdmin.getProxy()) {'OK': True, 'Value': }
- Returns
S_OK,S_ERROR
- 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:
>>> gLogger.notice(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:
>>> gLogger.notice(diracAdmin.getSiteMask()) {'OK': True, 'Value': 0L}
- Returns
S_OK,S_ERROR
- getSiteMaskLogging(site=None, printOutput=False)¶
Retrieves site mask logging information.
Example usage:
>>> gLogger.notice(diracAdmin.getSiteMaskLogging('LCG.AUVER.fr')) {'OK': True, 'Value': }
- Returns
S_OK,S_ERROR
- getSiteSection(site, printOutput=False)¶
Simple utility to get the list of CEs for DIRAC site name.
Example usage:
>>> gLogger.notice(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:
>>> gLogger.notice(diracAdmin.getVOMSProxy()) {'OK': True, 'Value': }
- Returns
S_OK,S_ERROR
- killPilot(gridReference)¶
Kill the pilot specified
>>> gLogger.notice(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:
>>> gLogger.notice(dirac.reset(12345)) {'OK': True, 'Value': [12345]}
- Parameters
job (integer or list of integers) – JobID
- Returns
S_OK,S_ERROR
- 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:
>>> gLogger.notice(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()¶
Upload a proxy to the DIRAC WMS. This method
Example usage:
>>> print diracAdmin.uploadProxy('dteam_pilot') {'OK': True, 'Value': 0L}
- Returns
S_OK,S_ERROR
- Parameters
permanent (boolean) – Indefinitely update proxy