From 9dae4dc345b640cf1ab23a2caa57be86981e4372 Mon Sep 17 00:00:00 2001 From: Barkin Simsek Date: Wed, 23 Apr 2025 12:53:13 +0900 Subject: [PATCH] Add "backupSceneFormat" option to the backup API. --- CHANGELOG.md | 6 ++++++ bin/mujin_webstackclientpy_downloaddata.py | 6 ++++-- python/mujinwebstackclient/version.py | 2 +- python/mujinwebstackclient/webstackclient.py | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f904c4a..e1b352e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.9.19 (2025-09-25) + +### Changes + +- Add `backupSceneFormat` option to the backup API. + ## 0.9.18 (2025-09-11) - Re-generate graph api. diff --git a/bin/mujin_webstackclientpy_downloaddata.py b/bin/mujin_webstackclientpy_downloaddata.py index 1bc00e8..0801f64 100755 --- a/bin/mujin_webstackclientpy_downloaddata.py +++ b/bin/mujin_webstackclientpy_downloaddata.py @@ -25,6 +25,7 @@ def _ParseArguments(): parser.add_argument('--url', type=str, default='http://127.0.0.1', help='URL of the controller (default: %(default)s)') parser.add_argument('--username', type=str, default='mujin', help='Username to login with (default: %(default)s)') parser.add_argument('--password', type=str, default='mujin', help='Password to login with (default: %(default)s)') + parser.add_argument('--backupSceneFormat', type=str, default=None, help='The scene format to use in backup files, one of "msgpack", "json", or "yaml" (default: %(default)s)') parser.add_argument('--timeout', type=float, default=600, help='Timeout in seconds (default: %(default)s)') return parser.parse_args() @@ -65,7 +66,7 @@ def _GetScenes(webClient): return sceneList -def _DownloadBackup(webClient, sceneList, timeout=600.0): +def _DownloadBackup(webClient, sceneList, backupSceneFormat, timeout=600.0): import re import tarfile @@ -73,6 +74,7 @@ def _DownloadBackup(webClient, sceneList, timeout=600.0): response = webClient.Backup( saveconfig=True, backupscenepks=sceneList, + backupSceneFormat=backupSceneFormat, timeout=timeout, ) @@ -92,7 +94,7 @@ def _Main(): webClient = _CreateWebstackClient(options.url, options.username, options.password) sceneList = _GetScenes(webClient) - downloadDirectory = _DownloadBackup(webClient, sceneList, timeout=options.timeout) + downloadDirectory = _DownloadBackup(webClient, sceneList, options.backupSceneFormat, timeout=options.timeout) print(downloadDirectory) # other scripts can read stdout and learn the directory path diff --git a/python/mujinwebstackclient/version.py b/python/mujinwebstackclient/version.py index b92d10d..2b53354 100644 --- a/python/mujinwebstackclient/version.py +++ b/python/mujinwebstackclient/version.py @@ -1,3 +1,3 @@ -__version__ = '0.9.18' +__version__ = '0.9.19' # Do not forget to update CHANGELOG.md diff --git a/python/mujinwebstackclient/webstackclient.py b/python/mujinwebstackclient/webstackclient.py index cd7dd42..f4927a9 100644 --- a/python/mujinwebstackclient/webstackclient.py +++ b/python/mujinwebstackclient/webstackclient.py @@ -1046,7 +1046,7 @@ def DeleteAllITLPrograms(self, timeout=5): # Backup restore # - def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, savewebapps=True, saveitl=True, savedetection=False, savestate=True, savecalibration=False, savedebug=False, saveeds=True, saveiodd=True, timeout=600): + def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, backupSceneFormat=None, savewebapps=True, saveitl=True, savedetection=False, savestate=True, savecalibration=False, savedebug=False, saveeds=True, saveiodd=True, timeout=600): """Downloads a backup file :param saveconfig: Whether we want to include configs in the backup, defaults to True @@ -1060,6 +1060,7 @@ def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, savewebap :param saveeds: Whether we want to include eds files in the backup, defaults to True :param saveiodd: Whether we want to include iodd files in the backup, defaults to True :param backupscenepks: List of scenes to backup, defaults to None + :param backupSceneFormat: The scene format to use in backup files, defaults to None :param timeout: Amount of time in seconds to wait before failing, defaults to 600 :raises WebstackClientError: If request wasn't successful :return: A streaming response to the backup file @@ -1080,6 +1081,7 @@ def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, savewebap 'eds': 'true' if saveeds else 'false', 'iodd': 'true' if saveiodd else 'false', 'backupScenePks': ','.join(backupscenepks) if backupscenepks else None, + 'backupSceneFormat': backupSceneFormat, }, timeout=timeout, )