Skip to content

Commit

Permalink
chore: supports custom config-variables and custom labels at the time…
Browse files Browse the repository at this point in the history
… of creating the device
  • Loading branch information
rrkumarshikhar committed Jun 16, 2024
1 parent df2f0dc commit 5d39756
Show file tree
Hide file tree
Showing 2 changed files with 244 additions and 37 deletions.
8 changes: 7 additions & 1 deletion rapyuta_io/clients/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5d39756

Please sign in to comment.