Skip to content

Commit 2078acf

Browse files
Disable logging of DeprecationWarnings and BrokenPipeErrors (#633)
1 parent 7c896e3 commit 2078acf

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
99
### Fixed
1010

1111
- config: Fixed crash when `token_transfer` index has `from` or `to` filter.
12+
- cli: Don't enforce logging `DeprecationWarning` warnings.
13+
- cli: Fixed `BrokenPipeError` messages when interrupting with DipDup with SIGINT.
1214

1315
### Security
1416

docs/cli-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
<section id="dipdup-run">
182182
<h2>run<a class="headerlink" href="#dipdup-run" title="Permalink to this heading">¶</a></h2>
183183
<p>Run indexer.</p>
184-
<p>Execution can be gracefully interrupted with <cite>Ctrl+C</cite> or <cite>SIGTERM</cite> signal.</p>
184+
<p>Execution can be gracefully interrupted with <cite>Ctrl+C</cite> or <cite>SIGINT</cite> signal.</p>
185185
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>dipdup<span class="w"> </span>run<span class="w"> </span><span class="o">[</span>OPTIONS<span class="o">]</span>
186186
</pre></div>
187187
</div>

src/dipdup/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class CLIContext:
204204
async def run(ctx: click.Context) -> None:
205205
"""Run indexer.
206206
207-
Execution can be gracefully interrupted with `Ctrl+C` or `SIGTERM` signal.
207+
Execution can be gracefully interrupted with `Ctrl+C` or `SIGINT` signal.
208208
"""
209209
from dipdup.config import DipDupConfig
210210
from dipdup.dipdup import DipDup

src/dipdup/utils/sys.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
IGNORE_SIGINT_CMDS = {*IGNORE_CONFIG_CMDS, None, 'schema', 'wipe'}
1414

1515
_is_shutting_down = False
16-
_logger = logging.getLogger(__name__)
1716

1817

1918
async def _shutdown() -> None: # pragma: no cover
@@ -22,7 +21,9 @@ async def _shutdown() -> None: # pragma: no cover
2221
return
2322
_is_shutting_down = True
2423

25-
_logger.info('Shutting down')
24+
# NOTE: Prevents BrokenPipeError when piping output to another process
25+
sys.stderr.close()
26+
2627
tasks = filter(lambda t: t != asyncio.current_task(), asyncio.all_tasks())
2728
list(map(asyncio.Task.cancel, tasks))
2829
await asyncio.gather(*tasks, return_exceptions=True)
@@ -63,5 +64,4 @@ def set_up_process(cmd: str | None) -> None:
6364

6465
# NOTE: Format warnings as normal log messages
6566
logging.captureWarnings(True)
66-
warnings.simplefilter('always', DeprecationWarning)
6767
warnings.formatwarning = lambda msg, *a, **kw: str(msg)

0 commit comments

Comments
 (0)