当前位置: 首页>>代码示例>>Python>>正文


Python Dirac.status方法代码示例

本文整理汇总了Python中DIRAC.Interfaces.API.Dirac.Dirac.status方法的典型用法代码示例。如果您正苦于以下问题:Python Dirac.status方法的具体用法?Python Dirac.status怎么用?Python Dirac.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.Interfaces.API.Dirac.Dirac的用法示例。


在下文中一共展示了Dirac.status方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CEBaseTest

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
class CEBaseTest( TestBase ):
  """
    CEBaseTest is base class for all the CE test classes. Real  CE test should
    implement its _judge method.
  """

  def __init__( self, args = None, apis = None ):
    super( CEBaseTest, self ).__init__( args, apis )

    self.timeout = self.args.get( 'timeout', 1800 )
    self.vo = self.args.get( 'VO' )
    self.testType = self.args[ 'TestType' ]
    self.executable = self.args[ 'executable' ]
    self.__logPath = '/opt/dirac/pro/BESDIRAC/ResourceStatusSystem/SAM/log'
    self.__scriptPath = '/opt/dirac/pro/BESDIRAC/ResourceStatusSystem/SAM/sam_script'

    if 'WMSAdministrator' in self.apis:
      self.wmsAdmin = self.apis[ 'WMSAdministrator' ]
    else:
      self.wmsAdmin = RPCClient( 'WorkloadManagement/WMSAdministrator' )

    if 'Dirac' in self.apis:
      self.dirac = self.apis[ 'Dirac' ]
    else:
      self.dirac = Dirac()


  def doTest( self, elementDict ):
    """
      submit test job to the specified ce or cloud..
    """

    elementName = elementDict[ 'ElementName' ]
    elementType = elementDict[ 'ElementType' ]
    vos = elementDict[ 'VO' ]

    site = None; ce = None
    if elementType == 'ComputingElement':
      ce = elementName
    if elementType == 'CLOUD':
      site = elementName

    if self.vo:
      submitVO = self.vo
    elif vos:
      submitVO = vos[ 0 ]
    else:
      submitVO = 'bes'

    submissionTime = datetime.utcnow().replace( microsecond = 0 )
    sendRes = self.__submit( site, ce, submitVO )
    if not sendRes[ 'OK' ]:
      return sendRes
    jobID = sendRes[ 'Value' ]

    result = { 'Result' : { 'JobID' : jobID,
                           'VO' : submitVO,
                           'SubmissionTime' : submissionTime },
              'Finish' : False }

    return S_OK( result )


  def __submit( self, site, CE, vo ):
    """
      set the job and submit.
    """

    job = Job()
    job.setName( self.testType )
    job.setJobGroup( 'CE-Test' )
    job.setExecutable( self.executable )
    job.setInputSandbox( '%s/%s' % ( self.__scriptPath, self.executable ) )
    if site and not CE:
      job.setDestination( site )
    if CE:
      job.setDestinationCE( CE )

    LOCK.acquire()
    proxyPath = BESUtils.getProxyByVO( 'zhangxm', vo )
    if not proxyPath[ 'OK' ]:
      LOCK.release()
      return proxyPath
    proxyPath = proxyPath[ 'Value' ]
    oldProxy = os.environ.get( 'X509_USER_PROXY' )
    os.environ[ 'X509_USER_PROXY' ] = proxyPath
    result = self.dirac.submit( job )
    if oldProxy is None:
      del os.environ[ 'X509_USER_PROXY' ]
    else:
      os.environ[ 'X509_USER_PROXY' ] = oldProxy
    LOCK.release()

    return result


  def getTestResult( self, elementName, vo, jobID, submissionTime ):
    """
      download output sandbox and judge the test status from the log file.
    """
#.........这里部分代码省略.........
开发者ID:besdiracgrid,项目名称:BESDIRAC,代码行数:103,代码来源:CEBaseTest.py

示例2: Dirac

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
#!/bin/env python

import sys

from DIRAC.Core.Base import Script
Script.parseCommandLine()

from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac

dirac = Dirac()
jobid = sys.argv[1]

print dirac.status(jobid)

summary_file = str(jobid) + "_summary.txt"
dirac.getJobSummary(jobid, outputFile=summary_file, printOutput=True)

print dirac.getJobDebugOutput(jobid)

print dirac.getJobLoggingInfo(jobid, printOutput=False)

开发者ID:adriansev,项目名称:auger-dirac,代码行数:23,代码来源:dirac.job_status.py

示例3: DIRACExit

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
    if not result['OK']:
      print "Error:", result['Message']
      DIRACExit( -1 )
    jobs += result['Value']  
        
if len( args ) < 1 and not jobs:
  Script.showHelp()

if len(args) > 0:
  jobs += args

try:
  jobs = [ int( job ) for job in jobs ]
except Exception, x:
  print 'Expected integer for jobID'
  exitCode = 2
  DIRAC.exit( exitCode )

result = dirac.status( jobs )
if result['OK']:
  for job in result['Value']:
    print 'JobID=' + str( job ),
    for status in result['Value'][job]:
      print status + '=' + result['Value'][job][status] + ';',
    print
else:
  exitCode = 2
  print "ERROR: %s" % result['Message']

DIRAC.exit( exitCode )
开发者ID:SimonBidwell,项目名称:DIRAC,代码行数:32,代码来源:dirac-wms-job-status.py

示例4: open

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac

if (len(sys.argv) < 2) :
    print 'the input file with ids should be specified'
    print 'if the 3rd argument is <get_output> the job output sandbox will be downloaded'
    sys.exit(os.EX_USAGE)

list = sys.argv[1]

get_output = False
if (len(sys.argv) > 2):
    if (sys.argv[2] == 'get_output'): get_output = True

id_list_file = open(list, 'r')

for line in id_list_file:
##    line = line.strip().decode("utf-8").replace("True","true").replace("False","false")
    line = line.replace("True","true").replace("False","false")
    line = line.replace("'","\"")
    j = json.loads(line)

    dirac = Dirac()
    print dirac.status(j['Value'])

    if get_output: print dirac.getOutputSandbox(j['Value'])

id_list_file.close()

开发者ID:adriansev,项目名称:auger-dirac,代码行数:30,代码来源:dirac.job_list_mgr.py

示例5: launch_batch_pict

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
		j.setExecutable(EXEC,arguments="-W 600 -H 600 -X -0.77568377 -Y -0.13646737 -P %f -M 500 %s" % (pitch, out_bmp))
        	pitch+=step
		
	j.setOutputSandbox(out_bmp_list + ["StdOut"] + ["StdErr"])
	result = dirac.submit(j)
	print 'Submission Result: ',result
	return result

n_produced_pict = 0
jobinfo_list = []
while n_produced_pict < N_PICT:
	pitch_start = n_produced_pict * P_STEP + P_START
	jobinfo = launch_batch_pict(pitch_start, P_STEP, N_PICT_BATCH)
	jobinfo_list.append(jobinfo)
	n_produced_pict += N_PICT_BATCH


job_state_dict = dict()
job_in_flight = ['start'] 
while len(job_in_flight) != 0  :
	for jobinfo in jobinfo_list :
		jobid=jobinfo['Value']
		status = dirac.status(jobid)
		state = status['Value'][jobid]['Status']
		job_state_dict[jobid] = state
	job_in_flight = [k for k, v in job_state_dict.items() if v != 'Done']
	print "Job still running :"
	print job_in_flight
	time.sleep(2)

开发者ID:fjammes,项目名称:misc,代码行数:31,代码来源:dirac-launch.py

示例6: dexit

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
     local_time = datetime.datetime.utcnow()
     timedelta = local_time-datetime.timedelta(seconds=86400)
     if specialOptions.has_key("dayspassed"):
         timedelta = local_time-datetime.timedelta(seconds=float(specialOptions["dayspassed"])*3600)
     res = w.getJobs(my_dict,timedelta.strftime( '%Y-%m-%d %H:%M:%S' ))
 
     if not res['OK']:
         gLogger.error("Could not get list of running jobs.",res['Message'])
         dexit(1)
     
     job_list = res['Value']
 else:
     job_list = specialOptions["JobID"].split(",")
     doLogging = True
 #for j in job_list:
 res = d.status(job_list)   
 
 if not res['OK']:
     gLogger.error("Could not get status of job_list,",res['Message'])
     dexit(1)
 
 status = res['Value']
 # get sites info
 sites = None
 res = w.getJobsSites(job_list)
 if not res['OK']:
     gLogger.error("Could not get sites;",res['Message'])
 else:
     sites = res['Value']
 
 if not do_xml:
开发者ID:sposs,项目名称:GlastDIRAC,代码行数:33,代码来源:dirac-glast-pipeline-status.py

示例7: open

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
j.setCPUTime(500)
j.setExecutable('/bin/echo hello')
j.setExecutable('/bin/hostname')
j.setExecutable('/bin/echo hello again')
j.setName('API')

result = dirac.submitJob(j)
print 'Submission Result: '
pprint.pprint(result)

jobid = result['JobID']

# print job id to file for future reference
joblog = open("jobid.log", "a")
joblog.write(str(jobid)+'\n')
joblog.close()

# to interactively check on job status do:
# dirac-wms-job-status -f jobid.log
print "\nThe current status of this job is:"
pprint.pprint(dirac.status(jobid))

joblog = open("jobid.log", "r")
# list comprehension :-D
all_jobids = [jobid.strip() for jobid in joblog.readlines()]

print "\nThe current status of all jobs is:"
all_status = dirac.status(all_jobids)
pprint.pprint(all_status)
开发者ID:ic-hep,项目名称:DIRAC-tools,代码行数:31,代码来源:hello_world_job.py

示例8: dexit

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import status [as 别名]
     if specialOptions.has_key("dayspassed"):
         timedelta = local_time-datetime.timedelta(seconds=float(specialOptions["dayspassed"])*3600)
     res = w.getJobs(my_dict,timedelta.strftime( '%Y-%m-%d %H:%M:%S' ))
 
     if not res['OK']:
         gLogger.error("Could not get list of running jobs.",res['Message'])
         dexit(1)
     
     job_list = res['Value']
 else:
     job_list = specialOptions["JobID"].split(",")
     doLogging = True
 status = {}
 sites = {} 
 for chunk in breakListIntoChunks(job_list,1000):
     res = d.status(chunk)   
     if not res['OK']:
         gLogger.error("Could not get status of job list chunk,",res['Message'])
         continue
     status.update(res['Value'])
 # get sites info
     res = w.getJobsSites(chunk)
     if not res['OK']:
         gLogger.error("Could not get sites;",res['Message'])
     sites.update(res['Value'])
 
 if not do_xml:
     print('# ID\thostname\tStatus\tSubmitted\tStarted\tEnded\tCPUtime\tMemory')
 for j in job_list:
     status_j=status[int(j)]
     if doLogging:
开发者ID:vrolland,项目名称:GlastDIRAC,代码行数:33,代码来源:dirac-glast-pipeline-status.py


注:本文中的DIRAC.Interfaces.API.Dirac.Dirac.status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。