From 33481627b51e7f098344d274e624c52abf177384 Mon Sep 17 00:00:00 2001 From: KUMAR SHIKHAR Date: Mon, 17 Jun 2024 02:33:13 +0530 Subject: [PATCH] chore: supports custom config-variables and custom labels at the time of creating the device --- rapyuta_io/clients/device.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rapyuta_io/clients/device.py b/rapyuta_io/clients/device.py index df96af2b..ff153d1b 100644 --- a/rapyuta_io/clients/device.py +++ b/rapyuta_io/clients/device.py @@ -253,7 +253,8 @@ class Device(PartialMixin, ObjDict): def __init__(self, name, runtime=None, runtime_docker=False, runtime_preinstalled=False, ros_distro=None, rosbag_mount_path=None, - ros_workspace=None, description=None, python_version=DevicePythonVersion.PYTHON2): + ros_workspace=None, description=None, python_version=DevicePythonVersion.PYTHON2, + config_variables=None, labels=None): self.validate(name, runtime, runtime_docker, runtime_preinstalled, ros_distro, rosbag_mount_path, ros_workspace, description, python_version) self.name = name @@ -272,6 +273,8 @@ def __init__(self, name, runtime=None, runtime_docker=False, runtime_preinstalle self._ros_workspace = ros_workspace self.description = description self.python_version = python_version + self.config_variables = config_variables if config_variables else {} + self.labels = labels if labels else {} @staticmethod def validate(name, runtime, runtime_docker, runtime_preinstalled, ros_distro, rosbag_mount_path, @@ -320,6 +323,9 @@ def _serialize(self): '_ros_workspace']: if getattr(self, field): device['config_variables'][field[1:]] = getattr(self, field) + for key, value in self.config_variables.items(): + device['config_variables'][key] = value + device['labels'] = self.labels return device @classmethod