Skip to content

Commit fee30f8

Browse files
committed
fix(device): handle background command execution status
1 parent 1086172 commit fee30f8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

rapyuta_io/clients/device.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ def execute_command(self, command, retry_limit=0):
561561
>>> device.execute_command(command)
562562
563563
"""
564-
if command.bg:
565-
command.cmd += ' &'
566564
command.validate()
567565
command.device_ids = [self.uuid]
568566
url = self._device_api_host + DEVICE_COMMAND_API_PATH
@@ -572,6 +570,11 @@ def execute_command(self, command, retry_limit=0):
572570
execution_result = get_api_response_data(response)
573571
if not command.bg and not command.run_async:
574572
return execution_result[self.uuid]
573+
574+
# returning SUCCESS for background command as we are expecting that it ran successfully.
575+
if command.bg and not command.run_aysnc:
576+
return {'status': 'SUCCESS'}
577+
575578
jid = execution_result.get('jid')
576579
if not jid:
577580
raise ValueError("Job ID not found in the response")

rapyuta_io/clients/device_manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ def execute_command(
178178

179179
execution_result = get_api_response_data(response)
180180

181-
if not command.bg:
181+
if not command.bg and not command.run_async:
182182
return execution_result
183+
184+
if command.bg and not command.run_async:
185+
return {'status': 'SUCCESS'}
183186

184187
jid = execution_result.get('jid')
185188
if not jid:

0 commit comments

Comments
 (0)