From 65f0ea386032e96fce434a314be06ec89d5cf3c1 Mon Sep 17 00:00:00 2001 From: Simon Branford <4967+branfosj@users.noreply.github.com> Date: Thu, 4 Apr 2024 13:44:21 +0100 Subject: [PATCH 1/3] add replacements for run_cmd_qa --- docs/easybuild-v5/run_shell_cmd.md | 51 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/docs/easybuild-v5/run_shell_cmd.md b/docs/easybuild-v5/run_shell_cmd.md index d1df7bd7d..9cf8559d2 100644 --- a/docs/easybuild-v5/run_shell_cmd.md +++ b/docs/easybuild-v5/run_shell_cmd.md @@ -56,34 +56,29 @@ Examples: ec = res.code ``` -## Transitioning from `run_cmd` to `run_shell_cmd` +## Transitioning from `run_cmd` and `run_cmd_qa` to `run_shell_cmd` For parameters in general, the following translation table can be used, where the default values are shown: -| run_cmd parameter |run_shell_cmd parameter| meaning | -| ---------------------|-----------------------|---------| -| `cmd` | `cmd` | command to run | -| `log_all=False` | (removed) | always log command output and exit code *(now always `True`)* | -| `simple=False` | (removed) | if `True`, just return `True`/`False` to indicate success *(obsolete)* | -| `regexp=True` | (removed) | regex used to check the output for errors *(obsolete)* | -| `log_ok=True` | `fail_on_error=True` | fail on non-zero exit code | -| | `split_error=False` | split of stderr from stdout output *(new feature)*| -| `inp=None` | `stdin=None` | the input given to the command via `stdin` | -| | `env=None` | environment to use to run command (if `None`, inherit current process environment) *(new feature)* | -| `trace=True` | `hidden=False` | don't show command in terminal output with `--trace`, or `--extended-dry-run` / `-x`) | -| `force_in_dry_run=False`| `in_dry_run=False` | also run command in dry run mode | -| `verbose=True` | `verbose_dry_run=False` | show that command is run in dry run mode (overrules `--hidden`) | -| `path=None` | `work_dir=None` | working directory to run command in (current working directory if `None`) | -| `shell=None` | `use_bash=True` | execute command through bash shell (`run_cmd` enables this for `None`)| -| `log_output=False` | `output_file=True` | collect command output in temporary output file *(changed default)* | -| `stream_output=None` | `stream_output=None` | stream command output to stdout (auto-enabled with `--logtostdout` if `None`) | -| `asynchronous=False` | `asynchronous=False` | run command asynchronously (not yet implemented for `run_shell_cmd`)| -| `with_hooks=True` | `with_hooks=True` | trigger pre/post `run_cmd` or `run_shell_cmd` hooks | -| | `qa_patterns=None` | list of 2-tuples with patterns for questions + corresponding answers (not yet implemented for `run_shell_cmd`) | -| | `qa_wait_patterns=None`| list of 2-tuples with patterns for non-questions and number of iterations to allow these patterns to match with end out command output (not yet implemented for `run_shell_cmd`)| - -## Transitioning from `run_cmd_qa` to `run_shell_cmd` - -This is still to be implemented in `run_shell_cmd`. - -... +| run_cmd / run_cmd_qa parameter | run_shell_cmd parameter | meaning | +| -------------------------------|-------------------------|---------| +| `cmd` | `cmd` | command to run | +| `log_all=False` | (removed) | always log command output and exit code *(now always `True`)* | +| `simple=False` | (removed) | if `True`, just return `True`/`False` to indicate success *(obsolete)* | +| `regexp=True` | (removed) | regex used to check the output for errors *(obsolete)* | +| `log_ok=True` | `fail_on_error=True` | fail on non-zero exit code | +| | `split_error=False` | split of stderr from stdout output *(new feature)*| +| `inp=None` | `stdin=None` | the input given to the command via `stdin` | +| | `env=None` | environment to use to run command (if `None`, inherit current process environment) *(new feature)* | +| `trace=True` | `hidden=False` | don't show command in terminal output with `--trace`, or `--extended-dry-run` / `-x`) | +| `force_in_dry_run=False` | `in_dry_run=False` | also run command in dry run mode | +| `verbose=True` | `verbose_dry_run=False` | show that command is run in dry run mode (overrules `--hidden`) | +| `path=None` | `work_dir=None` | working directory to run command in (current working directory if `None`) | +| `shell=None` | `use_bash=True` | execute command through bash shell (`run_cmd` enables this for `None`)| +| `log_output=False` | `output_file=True` | collect command output in temporary output file *(changed default)* | +| `stream_output=None` | `stream_output=None` | stream command output to stdout (auto-enabled with `--logtostdout` if `None`) | +| `asynchronous=False` | `asynchronous=False` | run command asynchronously (not yet implemented for `run_shell_cmd`)| +| `with_hooks=True` | `with_hooks=True` | trigger pre/post `run_cmd` or `run_shell_cmd` hooks | +| `qa` and `std_qa=None` | `qa_patterns=None` | list of 2-tuples with patterns for questions + corresponding answers | +| `no_qa=None` | `qa_wait_patterns=None` | list of 2-tuples with patterns for non-questions and number of iterations to allow these patterns to match with end out command output | +| `maxhits=50` | `qa_timeout=100` | amount of seconds to wait until more output is produced when there is no matching question | From c37bfdd75dfc1d56e6ddc0e3d51bbdcfaff6d4cc Mon Sep 17 00:00:00 2001 From: Simon Branford <4967+branfosj@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:25:03 +0100 Subject: [PATCH 2/3] update description to match code --- docs/easybuild-v5/run_shell_cmd.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/easybuild-v5/run_shell_cmd.md b/docs/easybuild-v5/run_shell_cmd.md index 9cf8559d2..afd85c777 100644 --- a/docs/easybuild-v5/run_shell_cmd.md +++ b/docs/easybuild-v5/run_shell_cmd.md @@ -80,5 +80,5 @@ For parameters in general, the following translation table can be used, where th | `asynchronous=False` | `asynchronous=False` | run command asynchronously (not yet implemented for `run_shell_cmd`)| | `with_hooks=True` | `with_hooks=True` | trigger pre/post `run_cmd` or `run_shell_cmd` hooks | | `qa` and `std_qa=None` | `qa_patterns=None` | list of 2-tuples with patterns for questions + corresponding answers | -| `no_qa=None` | `qa_wait_patterns=None` | list of 2-tuples with patterns for non-questions and number of iterations to allow these patterns to match with end out command output | +| `no_qa=None` | `qa_wait_patterns=None` | list of strings with patterns for non-questions | | `maxhits=50` | `qa_timeout=100` | amount of seconds to wait until more output is produced when there is no matching question | From 44166d3292ecadf73974132ef8301db8c27469d5 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 6 Apr 2024 12:10:57 +0200 Subject: [PATCH 3/3] fix description for `asynchronous` option in table on transitioning from `run_cmd` to `run_shell_cmd` --- docs/easybuild-v5/run_shell_cmd.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/easybuild-v5/run_shell_cmd.md b/docs/easybuild-v5/run_shell_cmd.md index afd85c777..926fe104e 100644 --- a/docs/easybuild-v5/run_shell_cmd.md +++ b/docs/easybuild-v5/run_shell_cmd.md @@ -77,7 +77,7 @@ For parameters in general, the following translation table can be used, where th | `shell=None` | `use_bash=True` | execute command through bash shell (`run_cmd` enables this for `None`)| | `log_output=False` | `output_file=True` | collect command output in temporary output file *(changed default)* | | `stream_output=None` | `stream_output=None` | stream command output to stdout (auto-enabled with `--logtostdout` if `None`) | -| `asynchronous=False` | `asynchronous=False` | run command asynchronously (not yet implemented for `run_shell_cmd`)| +| `asynchronous=False` | `asynchronous=False` | run command asynchronously | | `with_hooks=True` | `with_hooks=True` | trigger pre/post `run_cmd` or `run_shell_cmd` hooks | | `qa` and `std_qa=None` | `qa_patterns=None` | list of 2-tuples with patterns for questions + corresponding answers | | `no_qa=None` | `qa_wait_patterns=None` | list of strings with patterns for non-questions |