Beispiel #1
0
def test_poll_task_with_no_submit():
    from libensemble.executors.executor import Task
    print("\nTest: {}\n".format(sys._getframe().f_code.co_name))
    setup_executor()
    exctr = Executor.executor

    # Create a task directly with no submit (Not supported for users)
    myapp = exctr.sim_default_app
    task1 = Task(app=myapp, stdout='stdout.txt')
    try:
        task1.poll()
    except ExecutorException as e:
        assert e.args[0][:38] == 'Polled task task_my_simtask.x.simfunc_'
        assert e.args[0][
            40:] == ' has no process ID - check tasks been launched'
    else:
        assert 0
Beispiel #2
0
def test_poll_task_with_no_submit():
    from libensemble.executors.executor import Task
    print("\nTest: {}\n".format(sys._getframe().f_code.co_name))
    setup_executor()
    exctr = Executor.executor

    # Create a task directly with no submit (Not supported for users)
    exp_msg = ('Polled task libe_task_my_simtask.x_.+ '
               'has no process ID - check tasks been launched')
    exp_re = re.compile(exp_msg)
    myapp = exctr.sim_default_app
    task1 = Task(app=myapp, stdout='stdout.txt')
    try:
        task1.poll()
    except ExecutorException as e:
        assert bool(re.match(exp_re, e.args[0]))
    else:
        assert 0