Example #1
0
 def setUp(self):
     self.pilotsLoggingClient = PilotsLoggingClient()
Example #2
0
  Print results using printTable from PrettyPrint
  """
    content = []
    labels = [
        'pilotUUID', 'timestamp', 'source', 'phase', 'status', 'messageContent'
    ]
    for log in logs:
        content.append([log[label] for label in labels])
    printTable(labels, content, numbering=False, columnSeparator=' | ')


from DIRAC.WorkloadManagementSystem.Client.PilotsLoggingClient import PilotsLoggingClient
from DIRAC.WorkloadManagementSystem.Client.WMSAdministratorClient import WMSAdministratorClient

if uuid:
    result = PilotsLoggingClient().getPilotsLogging(uuid)
    if not result['OK']:
        print 'ERROR: %s' % result['Message']
        DIRAC.exit(1)
    printPilotsLogging(result['Value'])
    DIRAC.exit(0)
else:
    info = WMSAdministratorClient().getPilots(jobid)
    if not info['OK']:
        print info['Message']
        DIRAC.exit(1)
    for pilot in info['Value']:
        logging = PilotsLoggingClient().getPilotsLogging(
            pilot['PilotJobReference'])
        if not logging['OK']:
            print logging['Message']
Script.parseCommandLine()


def printPilotsLogging(logs):
  """
  Print results using printTable from PrettyPrint
  """
  content = []
  labels = ['pilotUUID', 'timestamp', 'source', 'phase', 'status', 'messageContent']
  for log in logs:
    content.append([log[label] for label in labels])
  printTable(labels, content, numbering=False, columnSeparator=' | ')


if uuid:
  pilotsLogging = PilotsLoggingClient()
  result = pilotsLogging.getPilotsLogging(uuid)
  if not result['OK']:
    print 'ERROR: %s' % result['Message']
    DIRAC.exit(1)
  printPilotsLogging(result['Value'])
  DIRAC.exit(0)
else:
  pilotDB = PilotAgentsDB()
  pilotsLogging = PilotsLoggingClient()
  pilots = pilotDB.getPilotsForJobID(jobid)
  if not pilots['OK ']:
    print pilots['Message']
  for pilotID in pilots:
    info = pilotDB.getPilotInfo(pilotID=pilotID)
    if not info['OK']: