コード例 #1
0
ファイル: test_local.py プロジェクト: fsimkovic/pyjob
 def test_terminate_5(self):
     scripts = [pytest.helpers.get_py_script(i, 1000000) for i in range(10)]
     with LocalTask(scripts, processes=min(CPU_COUNT, 2)) as task:
         with pytest.raises(PyJobError):
             task.run()
             pytest.helpers.unlink(task.script[4:])
     pytest.helpers.unlink(task.script[:4] + task.log)
コード例 #2
0
ファイル: test_local.py プロジェクト: fsimkovic/pyjob
 def test_performance_4(self):
     scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(64)]
     with LocalTask(scripts, processes=CPU_COUNT) as task:
         task.run()
     all_found = all(os.path.isfile(f) for f in task.log)
     pytest.helpers.unlink(task.script + task.log)
     assert all_found
コード例 #3
0
ファイル: test_local.py プロジェクト: fsimkovic/pyjob
 def test_terminate_9(self):
     scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(4)]
     task = LocalTask(scripts, processes=CPU_COUNT)
     task.run()
     with pytest.raises(PyJobTaskLockedError):
         task.run()
     task.wait()
     all_found = all(os.path.isfile(f) for f in task.log)
     pytest.helpers.unlink(task.script + task.log)
     assert all_found
コード例 #4
0
ファイル: test_local.py プロジェクト: fsimkovic/pyjob
 def test_terminate_7(self):
     scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(10000)]
     with LocalTask(scripts, processes=min(CPU_COUNT, 2)) as task:
         task.run()
         time.sleep(5)
         task.kill()
     all_scripts_found = all(os.path.isfile(path) for path in task.script)
     some_logs_found = any(os.path.isfile(log) for log in task.log) and not all(
         os.path.isfile(log) for log in task.log
     )
     pytest.helpers.unlink(task.script + task.log)
     assert all_scripts_found and some_logs_found
コード例 #5
0
ファイル: test_local.py プロジェクト: fsimkovic/pyjob
 def test_terminate_2(self):
     scripts = [pytest.helpers.get_py_script(i, 10000) for i in range(4)]
     task = LocalTask(scripts, processes=CPU_COUNT)
     task.run()
     task.close()
     all_found = all(os.path.isfile(f) for f in task.log)
     pytest.helpers.unlink(task.script + task.log)
     assert all_found
コード例 #6
0
ファイル: test_local.py プロジェクト: fsimkovic/pyjob
 def innerf():
     task = LocalTask(scripts, processes=min(CPU_COUNT, 2))
     task.run()
     files.extend(task.script + task.log)