예제 #1
0
파일: app.py 프로젝트: kube-HPC/python-env
def main():
    print("starting algorithm runner")
    conf = config.Config
    alg = Algorunner()
    alg.loadAlgorithm(conf.algorithm)
    job = alg.connectToWorker(conf.socket)
    job.join()
예제 #2
0
def test_failed_load_algorithm():
    alg = Algorithm()
    alg.algorithm = {
        "path": "no_such_path",
        "entryPoint": "main.py"
    }
    algorunner = Algorunner()
    algorunner.loadAlgorithm(alg)
    assert "No module named" in algorunner._loadAlgorithmError
    assert "no_such_path" in algorunner._loadAlgorithmError
    algorunner.close()
예제 #3
0
def xtest_load_algorithm():
    alg = Algorithm()
    alg.algorithm = {
        "path": "test_alg",
        "entryPoint": "main.py"
    }
    cwd = os.getcwd()
    os.chdir(cwd + '/tests')
    algorunner = Algorunner()
    algorunner.loadAlgorithm(alg)

    # os.chdir(cwd)
    result1 = algorunner._originalAlgorithm['start']({'input': mockdata.initData}, None)
    result2 = startCallback({'input': mockdata.initData})
    assert result1 == result2