Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066271
D3901.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3901.id.diff
View Options
diff --git a/swh/core/cli/__init__.py b/swh/core/cli/__init__.py
--- a/swh/core/cli/__init__.py
+++ b/swh/core/cli/__init__.py
@@ -5,13 +5,9 @@
import logging
import logging.config
-import signal
import click
import pkg_resources
-import yaml
-
-from ..sentry import init_sentry
LOG_LEVEL_NAMES = ["NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
@@ -88,6 +84,10 @@
def swh(ctx, log_level, log_config, sentry_dsn, sentry_debug):
"""Command line interface for Software Heritage.
"""
+ import signal
+ import yaml
+ from ..sentry import init_sentry
+
signal.signal(signal.SIGTERM, clean_exit_on_signal)
signal.signal(signal.SIGINT, clean_exit_on_signal)
diff --git a/swh/core/cli/db.py b/swh/core/cli/db.py
--- a/swh/core/cli/db.py
+++ b/swh/core/cli/db.py
@@ -4,16 +4,13 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
-import glob
import logging
from os import path, environ
-import subprocess
import warnings
import click
from swh.core.cli import CONTEXT_SETTINGS
-from swh.core.config import read as config_read
warnings.filterwarnings("ignore") # noqa prevent psycopg from telling us sh*t
@@ -34,6 +31,8 @@
def db(ctx, config_file):
"""Software Heritage database generic tools.
"""
+ from swh.core.config import read as config_read
+
ctx.ensure_object(dict)
if config_file is None:
config_file = environ.get("SWH_CONFIG_FILENAME")
@@ -73,6 +72,7 @@
will initialize the database for the `storage` section using initialization
scripts from the `swh.storage` package.
"""
+ import subprocess
for modname, cfg in ctx.obj["config"].items():
if cfg.get("cls") == "local" and cfg.get("args"):
@@ -172,6 +172,7 @@
def get_sql_for_package(modname):
+ import glob
from importlib import import_module
from swh.core.utils import numfile_sortkey as sortkey
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 4:38 AM (8 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225541
Attached To
D3901: cli: speedup the `swh` cli command startup time
Event Timeline
Log In to Comment