本文整理汇总了Python中saga.utils.test_config.add_tc_params_to_jd函数的典型用法代码示例。如果您正苦于以下问题:Python add_tc_params_to_jd函数的具体用法?Python add_tc_params_to_jd怎么用?Python add_tc_params_to_jd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_tc_params_to_jd函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_job_service_create
def test_job_service_create():
""" Test service.create_job() - expecting state 'NEW'
"""
js = None
try:
tc = testing.get_test_config ()
js = saga.job.Service(tc.job_service_url, tc.session)
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['10']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
assert j.state == j.get_state()
assert j.state == saga.job.NEW
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_close_js(js)
开发者ID:jcohen02,项目名称:saga-python,代码行数:26,代码来源:test_job.py
示例2: test_list_jobs
def test_list_jobs():
""" Test if a submitted job shows up in Service.list() """
j = None
js = None
try:
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
# create job service and job
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['10']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
# run job - now it has an id, and js must know it
j.run()
all_jobs = js.list()
assert j.id in all_jobs, \
"%s not in %s" % (j.id, all_jobs)
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:Thomas-Schatz,项目名称:saga-python,代码行数:33,代码来源:test_service.py
示例3: test_get_job
def test_get_job():
""" Test to submit a job, and retrieve it by id """
j = None
js = None
try:
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
# create job service and job
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['10']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
# run job - now it has an id, and js must be able to retrieve it by id
j.run()
j_clone = js.get_job(j.id)
assert j.id in j_clone.id
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:Thomas-Schatz,项目名称:saga-python,代码行数:32,代码来源:test_service.py
示例4: test_get_exit_code
def test_get_exit_code():
""" Test job.exit_code
"""
js = None
j = None
try:
tc = testing.get_test_config ()
js = saga.job.Service(tc.job_service_url, tc.session)
jd = saga.job.Description()
jd.executable = "/bin/sleep"
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
j.wait()
ec = j.exit_code
assert ec == 1, "%s != 1" % ec
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:jcohen02,项目名称:saga-python,代码行数:30,代码来源:test_job.py
示例5: test_job_suspend_resume
def test_job_suspend_resume():
""" Test job.suspend()/resume() - expecting state: SUSPENDED/RUNNING
"""
js = None
j = None
try:
tc = testing.get_test_config ()
js = saga.job.Service(tc.job_service_url, tc.session)
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['20']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
j.suspend()
assert j.state == saga.job.SUSPENDED
assert j.state == j.get_state()
j.resume()
assert j.state == saga.job.RUNNING
assert j.state == j.get_state()
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:jcohen02,项目名称:saga-python,代码行数:35,代码来源:test_job.py
示例6: test_job_wait
def test_job_wait():
""" Test job.wait() - expecting state: DONE (this test might take a while)
"""
js = None
j = None
try:
tc = testing.get_test_config ()
js = saga.job.Service(tc.job_service_url, tc.session)
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['10']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
j.wait()
assert j.state == saga.job.DONE, "%s != %s" % (j.state, saga.job.DONE)
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:jcohen02,项目名称:saga-python,代码行数:30,代码来源:test_job.py
示例7: test_job_run
def test_job_run():
""" Test job.run() - expecting state: RUNNING/PENDING
"""
js = None
j = None
try:
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
jd = saga.job.Description()
jd.executable = "/bin/sleep"
jd.arguments = ["10"]
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
assert j.state in [saga.job.RUNNING, saga.job.PENDING], "j.state: %s" % j.state
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:Thomas-Schatz,项目名称:saga-python,代码行数:30,代码来源:test_job.py
示例8: test_get_service_url
def test_get_service_url():
""" Test if job.service_url == Service.url
"""
js = None
try:
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
jd = saga.job.Description()
jd.executable = "/bin/sleep"
jd.arguments = ["10"]
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
assert j.service_url == js.url
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_close_js(js)
开发者ID:Thomas-Schatz,项目名称:saga-python,代码行数:26,代码来源:test_job.py
示例9: test_get_id
def test_get_id():
""" Test job.get_id() / job.id
"""
js = None
j = None
try:
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['10']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
assert j.id is not None
assert j.id == j.get_id()
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:agrill,项目名称:saga-python,代码行数:30,代码来源:test_job.py
示例10: helper_multiple_services
def helper_multiple_services(i):
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['10']
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
assert (j.state in [saga.job.RUNNING, saga.job.PENDING]), "job submission failed"
_silent_cancel(j)
_silent_close_js(js)
开发者ID:Thomas-Schatz,项目名称:saga-python,代码行数:12,代码来源:test_service.py
示例11: test_job_run_many
def test_job_run_many():
""" Run a bunch of jobs concurrently via the same job service.
"""
NUM_JOBS = 32
js = None
jobs = []
try:
tc = testing.get_test_config ()
js = saga.job.Service(tc.job_service_url, tc.session)
jd = saga.job.Description()
jd.executable = '/bin/sleep'
jd.arguments = ['60']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
for i in range(0, NUM_JOBS):
j = js.create_job(jd)
jobs.append(j)
# start all jobs
for job in jobs:
job.run()
# wait a bit
time.sleep(10)
for job in jobs:
job.cancel()
assert job.state == saga.job.CANCELED
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
for j in jobs:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:jcohen02,项目名称:saga-python,代码行数:43,代码来源:test_job.py
示例12: test_get_stdio
def test_get_stdio():
""" Test job.get_stdin/get_stdout/get_log
"""
js = None
j = None
try:
tc = testing.get_test_config ()
js = saga.job.Service(tc.job_service_url, tc.session)
jd = saga.job.Description()
jd.pre_exec = ['echo pre' ]
jd.executable = 'sh'
jd.arguments = ['-c', '"echo out; echo err 1>&2"']
jd.post_exec = ['echo post']
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
j.wait()
assert 0 == j.exit_code
assert 'pre' in j.get_log()
assert 'post' in j.get_log()
assert 'out' in j.get_stdout()
assert 'err' in j.get_stderr()
assert 'pre' in j.log
assert 'post' in j.log
assert 'out' in j.stdout
assert 'err' in j.stderr
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:jcohen02,项目名称:saga-python,代码行数:42,代码来源:test_job.py
示例13: test_job_multiline_run
def test_job_multiline_run():
""" Test job.run() with multiline command
"""
js = None
j = None
try:
tc = sutc.TestConfig()
js = saga.job.Service(tc.js_url, tc.session)
jd = saga.job.Description()
jd.executable = "/bin/sh"
jd.arguments = [
"""-c "python -c '
import time
if True :
if True :
time.sleep (3)
'
"
"""
]
# add options from the test .cfg file if set
jd = sutc.add_tc_params_to_jd(tc=tc, jd=jd)
j = js.create_job(jd)
j.run()
assert j.state in [saga.job.RUNNING, saga.job.PENDING], "j.state: %s" % j.state
j.wait()
assert j.state == saga.job.DONE, "j.state: %s " % j.state
except saga.NotImplemented as ni:
assert tc.notimpl_warn_only, "%s " % ni
if tc.notimpl_warn_only:
print "%s " % ni
except saga.SagaException as se:
assert False, "Unexpected exception: %s" % se
finally:
_silent_cancel(j)
_silent_close_js(js)
开发者ID:Thomas-Schatz,项目名称:saga-python,代码行数:39,代码来源:test_job.py
注:本文中的saga.utils.test_config.add_tc_params_to_jd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论