|
@@ -45,7 +45,7 @@ def start_engine(engine_path, gameserver, playcookie, **kwargs):
|
|
'Frameworks',
|
|
'Frameworks',
|
|
)
|
|
)
|
|
elif sys.platform == 'linux' and 'XAUTHORITY' in os.environ:
|
|
elif sys.platform == 'linux' and 'XAUTHORITY' in os.environ:
|
|
- """
|
|
|
|
|
|
+ """
|
|
Fix for TTREngine reporting:
|
|
Fix for TTREngine reporting:
|
|
> :display:x11display(error): Could not open display ":0.0".
|
|
> :display:x11display(error): Could not open display ":0.0".
|
|
> :ToonBase: Default graphics pipe is glxGraphicsPipe (OpenGL).
|
|
> :ToonBase: Default graphics pipe is glxGraphicsPipe (OpenGL).
|
|
@@ -121,7 +121,8 @@ def login(username=None, password=None,
|
|
raise Exception(repr(resp_data))
|
|
raise Exception(repr(resp_data))
|
|
|
|
|
|
|
|
|
|
-def launch(engine_path, username, password, validate_ssl_certs=True):
|
|
|
|
|
|
+def launch(engine_path, username, password, validate_ssl_certs=True,
|
|
|
|
+ cpu_limit_percent=None):
|
|
result = login(
|
|
result = login(
|
|
username=username,
|
|
username=username,
|
|
password=password,
|
|
password=password,
|
|
@@ -138,6 +139,13 @@ def launch(engine_path, username, password, validate_ssl_certs=True):
|
|
gameserver=result.gameserver,
|
|
gameserver=result.gameserver,
|
|
playcookie=result.playcookie,
|
|
playcookie=result.playcookie,
|
|
)
|
|
)
|
|
|
|
+ if cpu_limit_percent is not None:
|
|
|
|
+ subprocess.Popen(args=[
|
|
|
|
+ 'cpulimit',
|
|
|
|
+ '--pid', str(p.pid),
|
|
|
|
+ '--limit', str(cpu_limit_percent),
|
|
|
|
+ # '--verbose',
|
|
|
|
+ ])
|
|
p.wait()
|
|
p.wait()
|
|
else:
|
|
else:
|
|
raise Exception(repr(result))
|
|
raise Exception(repr(result))
|