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


Python Job._toJDL方法代码示例

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


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

示例1: test_basicJob

# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import _toJDL [as 别名]
def test_basicJob():
  job = Job()

  job.setOwner('ownerName')
  job.setOwnerGroup('ownerGroup')
  job.setName('jobName')
  job.setJobGroup('jobGroup')
  job.setExecutable('someExe')
  job.setType('jobType')
  job.setDestination('ANY')

  xml = job._toXML()

  try:
    with open('./DIRAC/Interfaces/API/test/testWF.xml') as fd:
      expected = fd.read()
  except IOError:
    with open('./Interfaces/API/test/testWF.xml') as fd:
      expected = fd.read()

  assert xml == expected

  try:
    with open('./DIRAC/Interfaces/API/test/testWFSIO.jdl') as fd:
      expected = fd.read()
  except IOError:
    with open('./Interfaces/API/test/testWFSIO.jdl') as fd:
      expected = fd.read()

  jdlSIO = job._toJDL(jobDescriptionObject=StringIO.StringIO(job._toXML()))
  assert jdlSIO == expected
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:33,代码来源:Test_JobAPI.py

示例2: test_SimpleParametricJob

# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import _toJDL [as 别名]
def test_SimpleParametricJob():

  job = Job()
  job.setExecutable('myExec')
  job.setLogLevel('DEBUG')
  parList = [1, 2, 3]
  job.setParameterSequence('JOB_ID', parList, addToWorkflow=True)
  inputDataList = [
      [
          '/lhcb/data/data1',
          '/lhcb/data/data2'
      ],
      [
          '/lhcb/data/data3',
          '/lhcb/data/data4'
      ],
      [
          '/lhcb/data/data5',
          '/lhcb/data/data6'
      ]
  ]
  job.setParameterSequence('InputData', inputDataList, addToWorkflow=True)

  jdl = job._toJDL()

  try:
    with open('./DIRAC/Interfaces/API/test/testWF.jdl') as fd:
      expected = fd.read()
  except IOError:
    with open('./Interfaces/API/test/testWF.jdl') as fd:
      expected = fd.read()

  assert jdl == expected

  clad = ClassAd('[' + jdl + ']')

  arguments = clad.getAttributeString('Arguments')
  job_id = clad.getAttributeString('JOB_ID')
  inputData = clad.getAttributeString('InputData')

  assert job_id == '%(JOB_ID)s'
  assert inputData == '%(InputData)s'
  assert 'jobDescription.xml' in arguments
  assert '-o LogLevel=DEBUG' in arguments
  assert'-p JOB_ID=%(JOB_ID)s' in arguments
  assert'-p InputData=%(InputData)s' in arguments
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:48,代码来源:Test_JobAPI.py

示例3: test_SimpleParametricJob

# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import _toJDL [as 别名]
  def test_SimpleParametricJob( self ):

    job = Job()
    job.setExecutable( 'myExec' )
    job.setLogLevel( 'DEBUG' )
    parList = [1,2,3]
    job.setParameterSequence( 'JOB_ID', parList, addToWorkflow=True )
    inputDataList = [
      [
        '/lhcb/data/data1',
        '/lhcb/data/data2'
      ],
      [
        '/lhcb/data/data3',
        '/lhcb/data/data4'
      ],
      [
        '/lhcb/data/data5',
        '/lhcb/data/data6'
      ]
    ]
    job.setParameterSequence( 'InputData', inputDataList, addToWorkflow=True )

    jdl = job._toJDL()

    print jdl

    clad = ClassAd( '[' + jdl + ']' )

    arguments = clad.getAttributeString( 'Arguments' )
    job_id = clad.getAttributeString( 'JOB_ID' )
    inputData = clad.getAttributeString( 'InputData' )

    print "arguments", arguments

    self.assertEqual( job_id, '%(JOB_ID)s' )
    self.assertEqual( inputData, '%(InputData)s' )
    self.assertIn( 'jobDescription.xml', arguments )
    self.assertIn( '-o LogLevel=DEBUG', arguments )
    self.assertIn( '-p JOB_ID=%(JOB_ID)s', arguments )
    self.assertIn( '-p InputData=%(InputData)s', arguments )
开发者ID:DIRACGrid-test,项目名称:DIRAC,代码行数:43,代码来源:Test_JobAPI.py

示例4: dexit

# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import _toJDL [as 别名]
            dexit(1)
        sites = result[ 'Value' ]
        j.setDestination(sites)

    if not opts.stagein is None:
        input_stage_files = []
        # we do add. input staging
        files = opts.stagein.split(",")
        for f in files:
            if f.startswith("LFN"):
                input_stage_files.append(f)
            else:
                input_stage_files+=extract_file(f)
        for f in input_stage_files:
            if not f.startswith("LFN"):
                gLogger.error("*ERROR* required inputfiles to be defined through LFN, could not find LFN in %s"%f)
                dexit(1)
        j.setInputData(input_stage_files)

    if opts.debug:
        gLogger.notice('*DEBUG* just showing the JDL of the job to be submitted')
        gLogger.notice(j._toJDL())
    
    d = Dirac(True,"myRepo.rep")
    res = d.submit(j)
    if not res['OK']:
        gLogger.error("Error during Job Submission ",res['Message'])
        dexit(1)
    JobID = res['Value']
    gLogger.notice("Your job %s (\"%s\") has been submitted."%(str(JobID),executable))
    
开发者ID:sposs,项目名称:GlastDIRAC,代码行数:32,代码来源:dirac-glast-pipeline-submit.py


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