Exemplo n.º 1
0
        pass
    elif switch[0] == 'Job':
      try:
        job = int( switch[1] )
      except:
        print "Invalid jobID", switch[1]

  if not job:
    args = Script.getPositionalArgs()

    if len( args ) == 1:
      requestName = args[0]
  else:
    from DIRAC.Interfaces.API.Dirac                              import Dirac
    dirac = Dirac()
    res = dirac.attributes( job )
    if not res['OK']:
      print "Error getting job parameters", res['Message']
    else:
      jobName = res['Value'].get( 'JobName' )
      if not jobName:
        print 'Job %d not found' % job
      else:
        requestName = jobname + '_job_%d' % job

  requests = []
  if requestName:
    requests = [requestName]
  elif resetFailed:
    res = reqClient.getRequestNamesList( ['Failed'], maxReset );
    if not res['OK']:
Exemplo n.º 2
0
import DIRAC
from DIRAC.Core.Base import Script

Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
                                     'Usage:',
                                     '  %s [option|cfgfile] ... JobID ...' % Script.scriptName,
                                     'Arguments:',
                                     '  JobID:    DIRAC Job ID' ] ) )
Script.parseCommandLine( ignoreErrors = True )
args = Script.getPositionalArgs()

if len( args ) < 1:
  Script.showHelp()

from DIRAC.Interfaces.API.Dirac                              import Dirac
dirac = Dirac()
exitCode = 0
errorList = []

for job in args:

  result = dirac.attributes( int(job), printOutput = True )
  if not result['OK']:
    errorList.append( ( job, result['Message'] ) )
    exitCode = 2

for error in errorList:
  print "ERROR %s: %s" % error

DIRAC.exit( exitCode )
Exemplo n.º 3
0
  if not result['OK']:
    errorList.append( ( gridID, result['Message'] ) )
    exitCode = 2
  else:
    res = result['Value'][ gridID ]
    if extendedPrint:
      tab = ''
      for key in ['PilotJobReference', 'Status', 'OwnerDN', 'OwnerGroup', 'SubmissionTime', 'DestinationSite', 'GridSite', ]:
        if key in res:
          diracAdmin.log.notice( '%s%s: %s' % ( tab, key, res[key] ) )
          if not tab:
            tab = '  '
      diracAdmin.log.notice( '' )
      for jobID in res['Jobs']:
        tab = '  '
        result = dirac.attributes( int( jobID ) )
        if not result['OK']:
          errorList.append( ( gridID, result['Message'] ) )
          exitCode = 2
        else:
          job = result['Value']
          diracAdmin.log.notice( '%sJob ID: %s' % ( tab, jobID ) )
          tab += '  '
          for key in [ 'OwnerDN', 'OwnerGroup', 'JobName', 'Status', 'StartExecTime', 'LastUpdateTime', 'EndExecTime' ]:
            if key in job:
              diracAdmin.log.notice( '%s%s:' % ( tab, key ) , job[key] )
      diracAdmin.log.notice( '' )
    else:
      print diracAdmin.pPrint.pformat( { gridID: res } )

Exemplo n.º 4
0
import DIRAC
from DIRAC.Core.Base import Script

Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
                                     'Usage:',
                                     '  %s [option|cfgfile] ... JobID ...' % Script.scriptName,
                                     'Arguments:',
                                     '  JobID:    DIRAC Job ID' ] ) )
Script.parseCommandLine( ignoreErrors = True )
args = Script.getPositionalArgs()

if len( args ) < 1:
  Script.showHelp()

from DIRAC.Interfaces.API.Dirac                              import Dirac
dirac = Dirac()
exitCode = 0
errorList = []

for job in args:

  result = dirac.attributes( int(job), printOutput = True )
  if not result['OK']:
    errorList.append( ( job, result['Message'] ) )
    exitCode = 2

for error in errorList:
  print "ERROR %s: %s" % error

DIRAC.exit( exitCode )
Exemplo n.º 5
0
                    date=day,
                    #owner="tmichael")['Value']]
                    owner="jlefaucheur")['Value']
            ]
        except KeyError:
            pass

n_jobs = len(running_ids)
if n_jobs > 0:
    print(
        "getting names from {} running/waiting jobs... please wait...".format(
            n_jobs))
    for i, id in enumerate(running_ids):
        if ((100 * i) / n_jobs) % 5 == 0:
            print("\r{} %".format(((20 * i) / n_jobs) * 5)),
        jobname = dirac.attributes(id)["Value"]["JobName"]
        running_names.append(jobname)
    else:
        print("\n... done")

# summary before submitting
print("\nrunning as:")
print(pilot_args_classify)
print("\nwith input_sandbox:")
print(input_sandbox)
print("\nwith output file:")
print(output_filename_template.format('{job_name}'))

for i, filelist in enumerate(
    [prod3b_filelist_gamma, prod3b_filelist_proton, prod3b_filelist_electron]):
    for run_filelist in sliding_window([l.strip() for l in filelist],
Exemplo n.º 6
0
    for day in days:
        try:
            [running_ids.add(id) for id in dirac.selectJobs(
                status=status, date=day,
                owner=username)['Value']]
        except KeyError:
            pass

n_jobs = len(running_ids)
if n_jobs > 0:
    print("getting names from {} running/waiting jobs... please wait..."
          .format(n_jobs))
    for i, id in enumerate(running_ids):
        if ((100 * i) / n_jobs) % 5 == 0:
            print("\r{} %".format(((20 * i) / n_jobs) * 5)),
        jobname = dirac.attributes(id)["Value"]["JobName"]
        running_names.append(jobname)
    else:
        print("\n... done")

# summary before submitting
print("\nrunning as:")
print(pilot_args_classify)
print("\nwith input_sandbox:")
print(input_sandbox)
print("\nwith output file:")
print(output_filename_template.format('{job_name}'))

for i, filelist in enumerate([
        prod3b_filelist_gamma,
        prod3b_filelist_proton,
Exemplo n.º 7
0
    for switch in Script.getUnprocessedSwitches():
        if switch[0] == 'Job':
            try:
                job = int(switch[1])
            except:
                print "Invalid jobID", switch[1]

    if not job:
        args = Script.getPositionalArgs()

        if len(args) == 1:
            requestName = args[0]
    else:
        from DIRAC.Interfaces.API.Dirac import Dirac
        dirac = Dirac()
        res = dirac.attributes(job)
        if not res['OK']:
            print "Error getting job parameters", res['Message']
        else:
            jobName = res['Value'].get('JobName')
            if not jobName:
                print 'Job %d not found' % job
            else:
                requestName = jobname + '_job_%d' % job

    if requestName:
        from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient
        reqClient = ReqClient()

        try:
            requestName = reqClient.getRequestName(int(requestName))