More work on server options

This commit is contained in:
Eric Froemling 2020-11-14 15:37:17 -08:00
parent 30fd8cddf1
commit 01d0a9c1eb
5 changed files with 43 additions and 33 deletions

View File

@ -3932,24 +3932,24 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/03/b2/f474954f36b60e6c630d37816a29",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/9a/2f88355ff7e46f9a9a3457890497",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e6/66/9b7795c8d90d9d7815490bfb1574",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/94/17/757605bdea7280b1b559a20a4506",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/99/b7/81eeecee7460e7bf027a276a8237",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ce/1c/1d030991c481b8943746a2cbba40",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/71/ef/93f3a65cc78de6a4ab0fd3031b81",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/74/e1/35e77d9346313158b68c8a3bc37d",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/66/05/f140215474e69744d6243ac2184a",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/91/01/26f0d7e1b028a08216b323d42c5e",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/b9/a7/f708eec454552ed15c3a513d6e1d",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/b2/1a/2a777a84b473e4eafbcefb912964",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/62/e1/70ff36467d1875af3e0e38da754c",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5c/83/e1f9e8db08f24a1d0b08958b9e09",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/ae/bc2f695f28eb3405415ea11c8083",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cb/ab/076371cc80fb408dfe2cbd4da8b0",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f0/70/203ffd8485f6e3b5432c70b556b3",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f5/51/9b37b71adfaa2d5ca706bc168b2f",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5d/87/089a0508c2876e6090f337a6a1c6",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fe/49/c33812c8596e946c4b7ff4a70176",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/65/c0/cede9d63e3c3fd3148b1d25ba62f",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4b/e0/26d2281f316b0f704a6a404b030b",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/a7/b8/988ab1f0d337516c034301ce219a",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/69/80/9068d8f99a060c625abee7b49184",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4f/4c/8590730e5d1cdae456c1b734a2a1",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/44/e5/d1c3162e114e51a5b5b826c2ec7c",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/21/8fab3da6b974cf323024d076b609",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/20/5d/881676243c5f44bdca677497b4d4",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/7b/a0862285f300e3521edce7fb5683",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1c/19/968b3971038ce3704afe5b347e61",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/63/57459f23a9dfa46ef63ef3717106",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/87/a5/dfc70d832fe46eb0e7c6fa72ee9e"
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/90/a3/e265c556587921cdfd8c753b592f",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/5e/80ac1a7a4a75de8869755aa7cbc1",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b0/4a/2144949c2cb6c3ef7d99c4409bfb",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/ce/078603417240c7f8a7f067d55a6f"
}

View File

@ -1,5 +1,6 @@
### 1.5.29 (20246)
- Exposed ba method/class initing in public C++ layer.
- The 'restart' and 'shutdown' commands in the server script now default to immediate=True
### 1.5.28 (20239)
- Simplified ba.enum_by_value()

View File

@ -32,10 +32,16 @@ if TYPE_CHECKING:
from types import FrameType
from bacommon.servermanager import ServerCommand
# Not sure how much versioning we'll do with this, but this will get
# printed at startup in case we need it.
VERSION_STR = '1.1.0'
# Version history:
# 1.1.0:
# Added shutdown command
# Changed restart to default to immediate=True
# Added clean_exit_minutes, unclean_exit_minutes, and idle_exit_minutes
# 1.0.0:
# Initial release
class ServerManagerApp:
"""An app which manages BallisticaCore server execution.
@ -223,25 +229,25 @@ class ServerManagerApp:
self._enqueue_server_command(
KickCommand(client_id=client_id, ban_time=ban_time))
def restart(self, immediate: bool = False) -> None:
def restart(self, immediate: bool = True) -> None:
"""Restart the server child-process.
This can be necessary for some config changes to take effect.
By default, the server will restart at the next good transition
point (end of a series, etc) but passing immediate=True will restart
it immediately.
By default, the server will exit immediately. If 'immediate' is passed
as False, however, the server will instead exit at the next clean
transition point (end of a series, etc).
"""
from bacommon.servermanager import ShutdownCommand, ShutdownReason
self._enqueue_server_command(
ShutdownCommand(reason=ShutdownReason.RESTARTING,
immediate=immediate))
def shutdown(self, immediate: bool = False) -> None:
def shutdown(self, immediate: bool = True) -> None:
"""Shut down the server child-process and exit the wrapper
By default, the server will exit at the next good transition
point (end of a series, etc) but passing immediate=True will stop
it immediately.
By default, the server will exit immediately. If 'immediate' is passed
as False, however, the server will instead exit at the next clean
transition point (end of a series, etc).
"""
from bacommon.servermanager import ShutdownCommand, ShutdownReason
self._enqueue_server_command(
@ -318,11 +324,14 @@ class ServerManagerApp:
self._kill_subprocess()
if self._shutdown_desired:
self._done = True
# Note: need to only do this if main thread is still in the
# interpreter; otherwise it seems this can lead to deadlock.
if not self._done:
self._done = True
# Our main thread will still be blocked in its prompt or whatnot;
# let it know it should die.
os.kill(os.getpid(), signal.SIGTERM)
# Our main thread is still be blocked in its prompt or
# whatnot; let it know it should die.
os.kill(os.getpid(), signal.SIGTERM)
def _prep_subprocess_environment(self) -> None:
"""Write files that must exist at process launch."""

View File

@ -1,7 +1,7 @@
# To configure your server, create a config.yaml file in the same directory
# as the ballisticacore_server script. This template config file can be
# as the ballisticacore_server script. The config_template.yaml file can be
# copied or renamed as a convenient starting point.
# Uncomment any of these values to set them.
# Uncomment any of these values to override defaults.
#__CONFIG_TEMPLATE_VALUES__

View File

@ -21,7 +21,7 @@
namespace ballistica {
// These are set automatically via script; don't change here.
const int kAppBuildNumber = 20248;
const int kAppBuildNumber = 20249;
const char* kAppVersion = "1.5.29";
// Our standalone globals.