You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/execute_process_refactor.md
+83-9Lines changed: 83 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,12 +262,12 @@ These parameters are drawn from the current `launch_ros.actions.Node`.
262
262
|Argument|Description|
263
263
|---|---|
264
264
|node_executable|the name of the executable to find if a package is provided or otherwise a path to the executable to run.|
265
-
|package|the package in which the node executable can be found|
266
-
|node_name|the name of the node|
267
-
|node_namespace|the ros namespace for this Node|
268
-
|parameters|list of names of yaml files with parameter rules, or dictionaries of parameters.|
269
-
|remappings|ordered list of 'to' and 'from' string pairs to be passed to the node as ROS remapping rules|
270
-
|arguments|list of extra arguments for the node|
265
+
|package|name of the ROS package the node executable lives in|
266
+
|node_name| name the node should have |
267
+
|node_namespace|namespace the node should create topics/services/etc in|
268
+
|parameters|list of either paths to yaml files or dictionaries of parameters|
269
+
|remappings|list of from/to pairs for remapping names|
270
+
|arguments|container specific arguments to be passed to the node|
271
271
272
272
#### Properties
273
273
@@ -293,7 +293,7 @@ Most parameters would be passed to the new superclass.
293
293
|---|---|
294
294
|node_plugin|name of the plugin to be loaded|
295
295
296
-
Additional parameters that may be passed, which are handled by `launch_ros.descriptions.Node`: `node_executable`, `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, `arguments`.
296
+
Additional parameters that may be passed, which are handled by `launch_ros.descriptions.Node`: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, `arguments`. Note that the parameter `node_executable` would not be passed to the superclass, as it is not applicable to this object.
297
297
298
298
#### Properties
299
299
@@ -309,7 +309,7 @@ No events would be handled or emitted.
309
309
310
310
### launch.actions.ExecuteLocalProcess
311
311
312
-
This class would represent the execution-time aspects of `launch.actions.ExecuteProcess`. The new `process_description` constructor parameter could be either a `launch.descriptions.Process` or a `launch_ros.descriptions.Node`; node-specific functionality is limited to proper configuration of the command line to be executed, so no special execution wrapper is needed. This is not the case for lifecycle nodes or composable nodes, which do require custom execution wrappers, described below.
312
+
Extends the `launch.actions.Action` class. This class would represent the execution-time aspects of `launch.actions.ExecuteProcess`. The new `process_description` constructor parameter could be either a `launch.descriptions.Process` or a `launch_ros.descriptions.Node`; node-specific functionality is limited to proper configuration of the command line to be executed, so no special execution wrapper is needed. This is not the case for lifecycle nodes or composable nodes, which do require custom execution wrappers, described below.
313
313
314
314
This class is simplified from the current `launch.actions.ExecuteProcess` by removing the logic relating to process definition/configuration, and by removing the logic regarding substitutions thereof.
315
315
@@ -432,4 +432,78 @@ Methods available from `launch.actions.ExecuteLocalProcess` are inherited: `get_
432
432
433
433
#### Events
434
434
435
-
Inherits events from `launch.actions.ExecuteLocalProcess`, but does not define any additional events.
435
+
Inherits events from `launch.actions.ExecuteLocalProcess`, but does not define any additional events.
436
+
437
+
## Future Extension
438
+
439
+
One topic of interest is the ability to launch nodes on remote machines as part of more complex systems. While the current refactoring will not attempt to implement this functionality, such functionality could be implemented using sibling classes to those described above.
440
+
441
+
### launch.actions.ExecuteSshProcess
442
+
443
+
Extends the `launch.actions.Action` class. This class would represent the execution-time aspects of an analog to `launch.actions.ExecuteProcess` which executes the given process via an SSH connection. This likely would be a remote machine in virtually all usages. This is *not* a subclass of the proposed `launch.actions.ExecuteLocalProcess` class; certain features provided by that class are not available from standard SSH connections.
444
+
445
+
It is also conceivable that this class, or one like it, could be constructed to simultaneously execute multiple processes over a single SSH connection. If this is attempted, several features such as input/output pipes would likely no longer be feasible.
446
+
447
+
Similar sibling classes could also be defined to combine SSH and Lifecycle or SSH and Composable Node containers.
| process\_description | the `launch.descriptions.Process` to execute as a local process |
454
+
| connection_description | an object defining the SSH connection information, such as host, port, user, etc. |
455
+
| prefix | a set of commands/arguments to preceed the `cmd`, used for things like `gdb`/`valgrind` and defaults to the `LaunchConfiguration` called `launch-prefix`|
456
+
| output | configuration for process output logging. Defaults to `log` i.e. log both `stdout` and `stderr` to launch main log file and stderr to the screen. |
457
+
| output\_format | for logging each output line, supporting `str.format()` substitutions with the following keys in scope: `line` to reference the raw output line and `this` to reference this action instance. |
458
+
| log\_cmd | if `True`, prints the final cmd before executing the process, which is useful for debugging when substitutions are involved. |
459
+
| on\_exit | list of actions to execute upon process exit. |
460
+
461
+
The following constructor parameters which were present in the proposed `launch.actions.ExecuteLocalProcess` are not provided as part of this class due to the SSH execution environment.
| process_details |`None` if the process is not yet started; otherwise an object containing information such as the command, working directory, environment, and process ID |
475
+
476
+
Additional properties provide access to constructor parameters for `process_description`, `connection_description`, and `output`.
| get_sub_entities | Override. If on_exit was provided in the constructor, returns that; otherwise returns an empty list. |
483
+
| execute | Override. Establishes event handlers for process execution, passes the execution context to the process definition for substitution expansion, then uses `osrf_pycommon.process_utils.async_execute_process` to launch the defined process. |
484
+
| get_asyncio_future | Override. Return an asyncio Future, used to let the launch system know when we're done. |
485
+
486
+
This assumes the SSH interface is provided by a library with get_asyncio_future support; if such a library is not found/used, an alternate method for providing the appropriate feedback will be required.
|`launch.events.process.ShutdownProcess`| begins standard shutdown procedure for a running executable |
495
+
|`launch.events.process.ProcessStdin`| passes the text provided by the event to the stdin of the process |
496
+
|`launch.events.Shutdown`| same as ShutdownProcess |
497
+
498
+
The `launch.events.process.SignalProcess` event is not handled by this class, due to the difficulty in managing signals across SSH. The `ProcessStdin` event may need to be evaluated, depending on the SSH interface.
0 commit comments