Skip to content

Commit 1c9cea3

Browse files
committed
Fix logging docs and remove demo script
1 parent 18236df commit 1c9cea3

8 files changed

Lines changed: 138 additions & 235 deletions

File tree

docs/source/_static/md/commands/build-options.md

Lines changed: 43 additions & 43 deletions
Large diffs are not rendered by default.
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
| Option | Default | Description |
2-
| -------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
3-
| `-c, --config FILE` | - | Path to configuration file. |
4-
| `-d, --directories` | `false` | Remove whole directories. |
5-
| `--database-url TEXT` | - | Url to the database. |
6-
| `-e, --exclude PATTERN` | - | A filename pattern to exclude files from the cleaning process. |
7-
| `--editor-url-scheme TEXT` | `file` | Use file, vscode, pycharm or a custom url scheme to add URLs to task ids to quickly jump to the task definition. Use no_link to disable URLs. |
8-
| `--hook-module TEXT` | - | Path to a Python module that contains hook implementations. |
9-
| `--ignore TEXT` | - | A pattern to ignore files or directories. Refer to 'pathlib.Path.match' for more info. |
10-
| `-k EXPRESSION` | - | Select tasks via expressions on task ids. |
11-
| `-m MARKER_EXPRESSION` | - | Select tasks via marker expressions. |
12-
| \`--mode \[dry-run | force | interactive\]\` |
13-
| `-q, --quiet` | `false` | Do not print the names of the removed paths. |
14-
| `--strict-markers` | `false` | Raise errors for unknown markers. |
15-
| `-h, --help` | - | Show this message and exit. |
1+
| Option | Default | Description |
2+
| -------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3+
| `-c, --config FILE` | - | Path to configuration file. |
4+
| `-d, --directories` | `false` | Remove whole directories. |
5+
| `--database-url TEXT` | - | Url to the database. |
6+
| `-e, --exclude PATTERN` | - | A filename pattern to exclude files from the cleaning process. |
7+
| `--editor-url-scheme TEXT` | `file` | Use file, vscode, pycharm or a custom url scheme to add URLs to task ids to quickly jump to the task definition. Use no_link to disable URLs. |
8+
| `--hook-module TEXT` | - | Path to a Python module that contains hook implementations. |
9+
| `--ignore TEXT` | - | A pattern to ignore files or directories. Refer to 'pathlib.Path.match' for more info. |
10+
| `-k EXPRESSION` | - | Select tasks via expressions on task ids. |
11+
| `-m MARKER_EXPRESSION` | - | Select tasks via marker expressions. |
12+
| `--mode [dry-run\|force\|interactive]` | `dry-run` | Choose 'dry-run' to print the paths of files/directories which would be removed, 'interactive' for a confirmation prompt for every path, and 'force' to remove all unknown paths at once. |
13+
| `-q, --quiet` | `false` | Do not print the names of the removed paths. |
14+
| `--strict-markers` | `false` | Raise errors for unknown markers. |
15+
| `-h, --help` | - | Show this message and exit. |
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
| Option | Default | Description |
2-
| --------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
3-
| `-c, --config FILE` | - | Path to configuration file. |
4-
| `--database-url TEXT` | - | Url to the database. |
5-
| `--hook-module TEXT` | - | Path to a Python module that contains hook implementations. |
6-
| `-l, --layout TEXT` | `dot` | The layout determines the structure of the graph. Here you find an overview of all available layouts: https://graphviz.org/docs/layouts. |
7-
| `-o, --output-path FILE` | `dag.pdf` | The output path of the visualization. The format is inferred from the file extension. |
8-
| \`-r, --rank-direction \[TB | LR | BT |
9-
| `-h, --help` | - | Show this message and exit. |
1+
| Option | Default | Description |
2+
| --------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
3+
| `-c, --config FILE` | - | Path to configuration file. |
4+
| `--database-url TEXT` | - | Url to the database. |
5+
| `--hook-module TEXT` | - | Path to a Python module that contains hook implementations. |
6+
| `-l, --layout TEXT` | `dot` | The layout determines the structure of the graph. Here you find an overview of all available layouts: https://graphviz.org/docs/layouts. |
7+
| `-o, --output-path FILE` | `dag.pdf` | The output path of the visualization. The format is inferred from the file extension. |
8+
| `-r, --rank-direction [TB\|LR\|BT\|RL]` | `TB` | The direction of the directed graph. It can be ordered from top to bottom, TB, left to right, LR, bottom to top, BT, or right to left, RL. |
9+
| `-h, --help` | - | Show this message and exit. |

docs/source/_static/md/commands/profile-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| `-c, --config FILE` | - | Path to configuration file. |
44
| `--database-url TEXT` | - | Url to the database. |
55
| `--editor-url-scheme TEXT` | `file` | Use file, vscode, pycharm or a custom url scheme to add URLs to task ids to quickly jump to the task definition. Use no_link to disable URLs. |
6-
| \`--export \[no | json | csv\]\` |
6+
| `--export [no\|json\|csv]` | `no` | Export the profile in the specified format. |
77
| `--hook-module TEXT` | - | Path to a Python module that contains hook implementations. |
88
| `--ignore TEXT` | - | A pattern to ignore files or directories. Refer to 'pathlib.Path.match' for more info. |
99
| `-h, --help` | - | Show this message and exit. |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div class="termy">
2+
3+
```console
4+
5+
$ pytask --log-cli --log-cli-level=INFO --show-capture=log
6+
────────────────────────── Start pytask session ─────────────────────────
7+
Platform: win32 -- Python 3.12.0, pytask 0.5.3, pluggy 1.3.0
8+
Root: C:\Users\pytask-dev\git\my_project
9+
Collected 2 tasks.
10+
11+
10:14:51 INFO build:preparing report.txt
12+
10:14:51 WARNING build:publishing report is about to fail
13+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
14+
┃ Task ┃ Outcome ┃
15+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
16+
│ <span class="termynal-dim">task_logging.py::</span>task_prepare_report │ <span class="termynal-success">. </span> │
17+
│ <span class="termynal-dim">task_logging.py::</span>task_publish_report │ <span class="termynal-failed">F </span> │
18+
└──────────────────────────────────┴─────────┘
19+
20+
<span style="color: #bf2d2d">──────────────────────────────── Failures ───────────────────────────────</span>
21+
22+
<span style="color: #bf2d2d">─────────────── Task </span><span style="color: #6c1e1e; font-weight: bold">task_logging.py::</span><span style="color: #bf2d2d">task_publish_report</span><span style="color: #bf2d2d"> failed ───────────────</span>
23+
24+
<span style="color: #f14c4c">╭───────────────────</span><span style="color: #f14c4c; font-weight: bold;"> Traceback </span><span style="color: #6c1e1e; font-weight: bold">(most recent call last)</span><span style="color: #f14c4c"> ─────────────────╮</span>
25+
<span style="color: #cd3131">│</span> <span style="color: #cd3131">│</span>
26+
<span style="color: #cd3131">│</span> <span style="color: #e5e510">...\git\my_project\task_logging.py</span>:<span style="color: #3b8eea">18</span> in <span style="color: #23d18b">task_publish_report</span> <span style="color: #cd3131">│</span>
27+
<span style="color: #cd3131">│</span> <span style="color: #cd3131">│</span>
28+
<span style="color: #cd3131">│</span> 15 │ logger.warning(<span style="color: #e5e510">"publishing report is about to fail"</span>) <span style="color: #cd3131">│</span>
29+
<span style="color: #cd3131">│</span> 16 │ print(<span style="color: #e5e510">"stdout from publish"</span>) <span style="color: #cd3131">│</span>
30+
<span style="color: #cd3131">│</span> 17 │ sys.stderr.write(<span style="color: #e5e510">"stderr from publish\n"</span>) <span style="color: #cd3131">│</span>
31+
<span style="color: #cd3131">│</span> <span style="color: #cd3131">❱ </span>18 │ <span style="color: #3b8eea">raise</span> <span style="color: #23d18b">RuntimeError</span>(<span style="color: #e5e510">"simulated publish failure"</span>) <span style="color: #cd3131">│</span>
32+
<span style="color: #cd3131">│</span> 19 <span style="color: #cd3131">│</span>
33+
<span style="color: #cd3131">╰───────────────────────────────────────────────────────────────────────╯</span>
34+
<span style="color: #f14c4c; font-weight: bold;">RuntimeError:</span> simulated publish failure
35+
36+
─────────────────────── Captured log during call ────────────────────────
37+
10:14:51 WARNING build:publishing report is about to fail
38+
```
39+
40+
</div>

docs/source/tutorials/capturing_output.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ You can also export task logs to a file with `--log-file` and customize the form
6161
with `--log-format`, `--log-date-format`, `--log-file-format`, and
6262
`--log-file-date-format`.
6363

64+
The animation below shows the same warning appearing once as a live log line during
65+
execution and again as captured log output in the failure report.
66+
67+
--8<-- "docs/source/_static/md/logging-live.md"
68+
6469
## Using print statements for debugging
6570

6671
One primary benefit of the default capturing of stdout/stderr output is that you can use

0 commit comments

Comments
 (0)