Skip to content

Commit 6ec0304

Browse files
author
Roger Strain
committed
Minor text updates, added brief remote concept
Distro A; OPSEC #2893 Signed-off-by: Roger Strain <[email protected]>
1 parent 3c14e3e commit 6ec0304

File tree

1 file changed

+83
-9
lines changed

1 file changed

+83
-9
lines changed

articles/execute_process_refactor.md

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ These parameters are drawn from the current `launch_ros.actions.Node`.
262262
|Argument|Description|
263263
|---|---|
264264
|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|
271271

272272
#### Properties
273273

@@ -293,7 +293,7 @@ Most parameters would be passed to the new superclass.
293293
|---|---|
294294
|node_plugin|name of the plugin to be loaded|
295295

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.
297297

298298
#### Properties
299299

@@ -309,7 +309,7 @@ No events would be handled or emitted.
309309

310310
### launch.actions.ExecuteLocalProcess
311311

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.
313313

314314
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.
315315

@@ -432,4 +432,78 @@ Methods available from `launch.actions.ExecuteLocalProcess` are inherited: `get_
432432

433433
#### Events
434434

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.
448+
449+
#### Constructor
450+
451+
| Argument | Description |
452+
| ---------------------- | ------------------------------------------------------------ |
453+
| 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.
462+
463+
| Argument | Rationale for Exclusion |
464+
| --------------- | ------------------------------------------------------------ |
465+
| shell | The process is being executed through SSH, which is by definition a shell |
466+
| sigterm_timeout | Signal handling across SSH is not robust |
467+
| sigkill_timeout | Signal handling across SSH is not robust |
468+
| emulate_tty | The process is being executed through SSH, which may restrict flexibility of TTY choice |
469+
470+
#### Properties
471+
472+
| Name | Description |
473+
| --------------- | ------------------------------------------------------------ |
474+
| 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`.
477+
478+
#### Methods
479+
480+
| Name | Description |
481+
| ------------------ | ------------------------------------------------------------ |
482+
| 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.
487+
488+
#### Events
489+
490+
##### Handled Events
491+
492+
| Event Type | Description |
493+
| --------------------------------------- | ------------------------------------------------------------ |
494+
| `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.
499+
500+
##### Emitted Events
501+
502+
| Event Type | Description |
503+
| -------------------------------------- | ------------------------------------------------------------ |
504+
| `launch.events.process.ProcessStarted` | emitted when the process starts |
505+
| `launch.events.process.ProcessExited` | emitted when the process exits; event contains return code |
506+
| `launch.events.process.ProcessStdout` | emitted when the process produces data the stdout pipe; event contains the data from the pipe |
507+
| `launch.events.process.ProcessStderr` | emitted when the process produces data the stderr pipe; event contains the data from the pipe |
508+
509+
The `ProcessStdout` and `ProcessStderr` events may need to be evaluated, depending on the SSH interface.

0 commit comments

Comments
 (0)