Skip to content

Commit

Permalink
feat(deployment): adds support for paramsync in device deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
amitsingh21 committed Aug 29, 2023
1 parent 17661c3 commit 3e0ab26
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions riocli/deployment/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def create_object(self, client: Client, **kwargs) -> typing.Any:

if 'runtime' in self.spec and runtime != self.spec.runtime:
raise Exception('>> runtime mismatch => deployment:{}.runtime !== package:{}.runtime '.format(
self.metadata.name, pkg['packageName']
))
self.metadata.name, pkg['packageName']
))

provision_config = pkg.get_provision_configuration(plan_id)

Expand Down Expand Up @@ -115,6 +115,32 @@ def create_object(self, client: Client, **kwargs) -> typing.Any:
provision_config.add_rosbag_job(component_name,
self._form_rosbag_job(req_job))

if 'features' in self.spec:
if 'params' in self.spec.features and self.spec.features.params.enabled:
component_id = internal_component.componentId
tree_names = self.spec.features.params.get('trees', [])
disable_sync = self.spec.features.params.get('disableSync',
False)

args = []
for e in executables:
args.append({
'executableId': e['id'],
'paramTreeNames': tree_names,
'enableParamSync': not disable_sync
})

context = provision_config.context
if 'component_context' not in context:
context['component_context'] = {}

component_context = context['component_context']
if component_id not in component_context:
component_context[component_id] = {}

component_context[component_id][
'param_sync_exec_args'] = args

if self.spec.runtime == 'cloud':
if 'staticRoutes' in self.spec:
for stroute in self.spec.staticRoutes:
Expand Down Expand Up @@ -160,31 +186,6 @@ def create_object(self, client: Client, **kwargs) -> typing.Any:
"instance": "rio-internal-headscale"
}]

if 'params' in self.spec.features and self.spec.features.params.enabled:
component_id = internal_component.componentId
tree_names = self.spec.features.params.get('trees', [])
disable_sync = self.spec.features.params.get('disableSync',
False)

args = []
for e in executables:
args.append({
'executableId': e['id'],
'paramTreeNames': tree_names,
'enableParamSync': not disable_sync
})

context = provision_config.context
if 'component_context' not in context:
context['component_context'] = {}

component_context = context['component_context']
if component_id not in component_context:
component_context[component_id] = {}

component_context[component_id][
'param_sync_exec_args'] = args

if self.spec.runtime == 'device':
device_guid, device = self.rc.find_depends(
self.spec.device.depends)
Expand Down

0 comments on commit 3e0ab26

Please sign in to comment.