mdify-cli 2.11.4__tar.gz → 2.11.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mdify_cli-2.11.4/mdify_cli.egg-info → mdify_cli-2.11.6}/PKG-INFO +1 -1
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify/__init__.py +1 -1
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify/cli.py +24 -5
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify/container.py +22 -8
- {mdify_cli-2.11.4 → mdify_cli-2.11.6/mdify_cli.egg-info}/PKG-INFO +1 -1
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/pyproject.toml +1 -1
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/LICENSE +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/README.md +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/assets/mdify.png +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify/__main__.py +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify/docling_client.py +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify_cli.egg-info/SOURCES.txt +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify_cli.egg-info/dependency_links.txt +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify_cli.egg-info/entry_points.txt +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify_cli.egg-info/requires.txt +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/mdify_cli.egg-info/top_level.txt +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/setup.cfg +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/tests/test_cli.py +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/tests/test_container.py +0 -0
- {mdify_cli-2.11.4 → mdify_cli-2.11.6}/tests/test_docling_client.py +0 -0
|
@@ -955,7 +955,13 @@ def main() -> int:
|
|
|
955
955
|
print(f"Starting docling-serve container...")
|
|
956
956
|
print()
|
|
957
957
|
|
|
958
|
-
with DoclingContainer(
|
|
958
|
+
with DoclingContainer(
|
|
959
|
+
runtime,
|
|
960
|
+
image,
|
|
961
|
+
args.port,
|
|
962
|
+
timeout=timeout,
|
|
963
|
+
keep_container=DEBUG,
|
|
964
|
+
) as container:
|
|
959
965
|
# Convert files
|
|
960
966
|
conversion_start = time.time()
|
|
961
967
|
spinner = Spinner()
|
|
@@ -1048,13 +1054,26 @@ def main() -> int:
|
|
|
1048
1054
|
|
|
1049
1055
|
# Always show logs for connection errors to surface root cause
|
|
1050
1056
|
print(" Retrieving container logs...", file=sys.stderr)
|
|
1051
|
-
logs = container.get_logs(tail=
|
|
1057
|
+
logs, log_error = container.get_logs(tail=50)
|
|
1052
1058
|
if logs:
|
|
1053
|
-
print(" Container logs (last
|
|
1059
|
+
print(" Container logs (last 50 lines):", file=sys.stderr)
|
|
1054
1060
|
for line in logs.strip().split("\n"):
|
|
1055
|
-
|
|
1061
|
+
if line.strip(): # Skip empty lines
|
|
1062
|
+
print(f" {line}", file=sys.stderr)
|
|
1063
|
+
elif log_error:
|
|
1064
|
+
print(f" Error retrieving logs: {log_error}", file=sys.stderr)
|
|
1065
|
+
if not DEBUG:
|
|
1066
|
+
print(
|
|
1067
|
+
" Tip: re-run with MDIFY_DEBUG=1 to preserve container for inspection",
|
|
1068
|
+
file=sys.stderr,
|
|
1069
|
+
)
|
|
1056
1070
|
else:
|
|
1057
|
-
print(" No logs available", file=sys.stderr)
|
|
1071
|
+
print(" No logs available (container may have been removed)", file=sys.stderr)
|
|
1072
|
+
if not DEBUG:
|
|
1073
|
+
print(
|
|
1074
|
+
" Tip: re-run with MDIFY_DEBUG=1 to preserve container logs",
|
|
1075
|
+
file=sys.stderr,
|
|
1076
|
+
)
|
|
1058
1077
|
|
|
1059
1078
|
if not container_alive:
|
|
1060
1079
|
print(" Stopping remaining conversions", file=sys.stderr)
|
|
@@ -20,7 +20,14 @@ class DoclingContainer:
|
|
|
20
20
|
# Container automatically stopped and removed
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
-
def __init__(
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
runtime: str,
|
|
26
|
+
image: str,
|
|
27
|
+
port: int = 5001,
|
|
28
|
+
timeout: int = 1200,
|
|
29
|
+
keep_container: bool = False,
|
|
30
|
+
):
|
|
24
31
|
"""Initialize container manager.
|
|
25
32
|
|
|
26
33
|
Args:
|
|
@@ -28,11 +35,13 @@ class DoclingContainer:
|
|
|
28
35
|
image: Container image to use
|
|
29
36
|
port: Host port to bind (default: 5001)
|
|
30
37
|
timeout: Conversion timeout in seconds (default: 1200)
|
|
38
|
+
keep_container: If True, do not auto-remove container (preserve logs)
|
|
31
39
|
"""
|
|
32
40
|
self.runtime = runtime
|
|
33
41
|
self.image = image
|
|
34
42
|
self.port = port
|
|
35
43
|
self.timeout = timeout
|
|
44
|
+
self.keep_container = keep_container
|
|
36
45
|
self.container_name = f"mdify-serve-{uuid.uuid4().hex[:8]}"
|
|
37
46
|
self.container_id: Optional[str] = None
|
|
38
47
|
|
|
@@ -91,7 +100,6 @@ class DoclingContainer:
|
|
|
91
100
|
self.runtime,
|
|
92
101
|
"run",
|
|
93
102
|
"-d", # Detached mode
|
|
94
|
-
"--rm", # Auto-remove on stop
|
|
95
103
|
"--name",
|
|
96
104
|
self.container_name,
|
|
97
105
|
"-p",
|
|
@@ -100,6 +108,8 @@ class DoclingContainer:
|
|
|
100
108
|
f"DOCLING_SERVE_MAX_SYNC_WAIT={self.timeout}",
|
|
101
109
|
self.image,
|
|
102
110
|
]
|
|
111
|
+
if not self.keep_container:
|
|
112
|
+
cmd.insert(3, "--rm") # Auto-remove on stop
|
|
103
113
|
|
|
104
114
|
try:
|
|
105
115
|
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
|
|
@@ -125,17 +135,17 @@ class DoclingContainer:
|
|
|
125
135
|
check=False,
|
|
126
136
|
)
|
|
127
137
|
|
|
128
|
-
def get_logs(self, tail: int = 50) -> str:
|
|
138
|
+
def get_logs(self, tail: int = 50) -> tuple[str, str]:
|
|
129
139
|
"""Get container logs for debugging.
|
|
130
140
|
|
|
131
141
|
Args:
|
|
132
142
|
tail: Number of lines to retrieve from end of logs
|
|
133
143
|
|
|
134
144
|
Returns:
|
|
135
|
-
|
|
145
|
+
Tuple of (stdout, stderr) from container logs
|
|
136
146
|
"""
|
|
137
147
|
if not self.container_name:
|
|
138
|
-
return ""
|
|
148
|
+
return ("", "No container name set")
|
|
139
149
|
|
|
140
150
|
try:
|
|
141
151
|
result = subprocess.run(
|
|
@@ -144,9 +154,13 @@ class DoclingContainer:
|
|
|
144
154
|
text=True,
|
|
145
155
|
check=False,
|
|
146
156
|
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
157
|
+
if result.returncode != 0:
|
|
158
|
+
return ("", f"Failed to get logs (exit {result.returncode}): {result.stderr}")
|
|
159
|
+
# Container logs come from both stdout and stderr
|
|
160
|
+
combined = result.stdout + result.stderr
|
|
161
|
+
return (combined, "")
|
|
162
|
+
except Exception as e:
|
|
163
|
+
return ("", f"Exception getting logs: {e}")
|
|
150
164
|
|
|
151
165
|
def is_running(self) -> bool:
|
|
152
166
|
"""Check if container process is still running.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|