def main(): print("starting algorithm runner") conf = config.Config alg = Algorunner() alg.loadAlgorithm(conf.algorithm) job = alg.connectToWorker(conf.socket) job.join()
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()
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