本文整理汇总了Python中openmdao.main.resource.ResourceAllocationManager.total_request方法的典型用法代码示例。如果您正苦于以下问题:Python ResourceAllocationManager.total_request方法的具体用法?Python ResourceAllocationManager.total_request怎么用?Python ResourceAllocationManager.total_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openmdao.main.resource.ResourceAllocationManager
的用法示例。
在下文中一共展示了ResourceAllocationManager.total_request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_request
# 需要导入模块: from openmdao.main.resource import ResourceAllocationManager [as 别名]
# 或者: from openmdao.main.resource.ResourceAllocationManager import total_request [as 别名]
def test_request(self):
logging.debug('')
logging.debug('test_request')
assembly = Assembly()
comp1 = assembly.add('comp1', ExtCode())
comp2 = assembly.add('comp2', ExtCode())
sub = assembly.add('sub', Assembly())
comp3 = sub.add('comp3', ExtCode())
comp1.resources = dict(min_cpus=10,
max_cpus=10,
resource_limits=dict(virtual_memory=100,
cpu_time=120),
rerunnable=True,
accounting_id='frobozz',
queue_name='debug',
job_category='MPI')
comp2.resources = dict(max_cpus=2,
resource_limits=dict(wallclock_time=1000000))
comp3.resources = dict(min_cpus=200,
resource_limits=dict(virtual_memory=20,
cpu_time=1000,
wallclock_time=500),
rerunnable=True,
accounting_id='frobozz',
queue_name='debug',
job_category='MPI')
req = RAM.max_request(assembly)
expected = dict(min_cpus=200,
max_cpus=200,
resource_limits=dict(virtual_memory=100,
cpu_time=1000,
wallclock_time=1000000))
logging.debug('req: %r', req)
logging.debug('exp: %r', expected)
self.assertEqual(req, expected)
req = RAM.total_request(assembly)
expected = dict(min_cpus=200,
max_cpus=200,
resource_limits=dict(virtual_memory=100,
cpu_time=1120,
wallclock_time=1000500),
rerunnable=True,
accounting_id='frobozz',
queue_name='debug',
job_category='MPI')
logging.debug('req: %r', req)
logging.debug('exp: %r', expected)
self.assertEqual(req, expected)
comp3.resources['accounting_id'] = 'xyzzy'
assert_raises(self, 'RAM.total_request(assembly)',
globals(), locals(), ValueError,
"Incompatible settings for 'accounting_id':"
" 'xyzzy' vs. 'frobozz'")
示例2: test_request
# 需要导入模块: from openmdao.main.resource import ResourceAllocationManager [as 别名]
# 或者: from openmdao.main.resource.ResourceAllocationManager import total_request [as 别名]
def test_request(self):
logging.debug('')
logging.debug('test_request')
assembly = Assembly()
comp1 = assembly.add('comp1', ExtCode())
comp2 = assembly.add('comp2', ExtCode())
sub = assembly.add('sub', Assembly())
comp3 = sub.add('comp3', ExtCode())
comp1.resources = dict(min_cpus=10,
max_cpus=10,
resource_limits=dict(virtual_memory=100,
cpu_time=120),
rerunnable=True,
accounting_id='frobozz',
queue_name='debug',
job_category='MPI')
comp2.resources = dict(max_cpus=2,
resource_limits=dict(wallclock_time=1000000))
comp3.resources = dict(min_cpus=200,
resource_limits=dict(virtual_memory=20,
cpu_time=1000,
wallclock_time=500),
rerunnable=True,
accounting_id='frobozz',
queue_name='debug',
job_category='MPI')
req = RAM.max_request(assembly)
expected = dict(min_cpus=200,
max_cpus=200,
resource_limits=dict(virtual_memory=100,
cpu_time=1000,
wallclock_time=1000000))
logging.debug('req: %r', req)
logging.debug('exp: %r', expected)
self.assertEqual(req, expected)
req = RAM.total_request(assembly)
expected = dict(min_cpus=200,
max_cpus=200,
resource_limits=dict(virtual_memory=100,
cpu_time=1120,
wallclock_time=1000500),
rerunnable=True,
accounting_id='frobozz',
queue_name='debug',
job_category='MPI')
logging.debug('req: %r', req)
logging.debug('exp: %r', expected)
self.assertEqual(req, expected)
comp3.resources['accounting_id'] = 'xyzzy'
try:
RAM.total_request(assembly)
except ValueError as err:
self.assertTrue("Incompatible settings for 'accounting_id':" in str(err))
self.assertTrue("'xyzzy'" in str(err))
self.assertTrue("'frobozz'" in str(err))
else:
self.fail("Exception expected")