mplang-nightly 0.1.dev174__py3-none-any.whl → 0.1.dev176__py3-none-any.whl
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.
- mplang/runtime/cli.py +32 -17
- mplang/runtime/server.py +5 -0
- mplang/runtime/session.py +3 -4
- {mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/METADATA +5 -5
- {mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/RECORD +8 -8
- {mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/WHEEL +0 -0
- {mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/entry_points.txt +0 -0
- {mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/licenses/LICENSE +0 -0
mplang/runtime/cli.py
CHANGED
@@ -195,14 +195,14 @@ def status_command(args: argparse.Namespace) -> int:
|
|
195
195
|
"""
|
196
196
|
|
197
197
|
async def _get_node_status(
|
198
|
-
node_id: str, endpoint: str, details:
|
198
|
+
node_id: str, endpoint: str, details: int = 0, timeout: int = 60
|
199
199
|
) -> dict[str, Any]:
|
200
200
|
"""Get status information for a single node.
|
201
201
|
|
202
202
|
Args:
|
203
203
|
node_id: Identifier for the node
|
204
204
|
endpoint: HTTP endpoint of the node
|
205
|
-
details:
|
205
|
+
details: Verbosity level (0=basic, 1=-v, 2=-vv)
|
206
206
|
timeout: HTTP request timeout in seconds (default: 60)
|
207
207
|
"""
|
208
208
|
|
@@ -224,21 +224,26 @@ def status_command(args: argparse.Namespace) -> int:
|
|
224
224
|
sessions = await client.list_sessions()
|
225
225
|
status["sessions"] = sessions
|
226
226
|
|
227
|
-
# Get detailed session info
|
228
|
-
|
227
|
+
# Get detailed session info based on verbosity level
|
228
|
+
# details=1 (-v): show session names and basic counts
|
229
|
+
# details=2 (-vv): show full computation and symbol lists
|
230
|
+
if details >= 1:
|
229
231
|
session_details = []
|
230
232
|
for session_name in sessions:
|
231
233
|
try:
|
232
234
|
# Get computations and symbols for each session
|
233
235
|
computations = await client.list_computations(session_name)
|
234
236
|
symbols = await client.list_symbols(session_name)
|
235
|
-
|
237
|
+
session_info = {
|
236
238
|
"name": session_name,
|
237
239
|
"computations": len(computations),
|
238
240
|
"symbols": len(symbols),
|
239
|
-
|
240
|
-
|
241
|
-
|
241
|
+
}
|
242
|
+
# Include full lists only at -vv level
|
243
|
+
if details >= 2:
|
244
|
+
session_info["computation_list"] = computations
|
245
|
+
session_info["symbol_list"] = symbols
|
246
|
+
session_details.append(session_info)
|
242
247
|
except Exception as e:
|
243
248
|
session_details.append({
|
244
249
|
"name": session_name,
|
@@ -255,13 +260,13 @@ def status_command(args: argparse.Namespace) -> int:
|
|
255
260
|
return status
|
256
261
|
|
257
262
|
async def _collect_cluster_status(
|
258
|
-
nodes: dict[str, str], details:
|
263
|
+
nodes: dict[str, str], details: int = 0
|
259
264
|
) -> list[dict[str, Any] | BaseException]:
|
260
265
|
"""Collect status from all nodes concurrently.
|
261
266
|
|
262
267
|
Args:
|
263
268
|
nodes: Dictionary mapping node IDs to their HTTP endpoints
|
264
|
-
details:
|
269
|
+
details: Verbosity level (0=basic, 1=-v, 2=-vv)
|
265
270
|
|
266
271
|
Returns:
|
267
272
|
List of status dictionaries or exceptions for each node
|
@@ -284,7 +289,8 @@ def status_command(args: argparse.Namespace) -> int:
|
|
284
289
|
node_addrs = {node_id: node.endpoint for node_id, node in nodes.items()}
|
285
290
|
|
286
291
|
# Collect status from all nodes
|
287
|
-
|
292
|
+
verbosity = getattr(args, "verbose", 0)
|
293
|
+
cluster_status = asyncio.run(_collect_cluster_status(node_addrs, verbosity))
|
288
294
|
|
289
295
|
# Basic node health check
|
290
296
|
print("Node Status:")
|
@@ -314,8 +320,8 @@ def status_command(args: argparse.Namespace) -> int:
|
|
314
320
|
print(f"{node_id:<15} {endpoint:<20} UNHEALTHY")
|
315
321
|
all_healthy = False
|
316
322
|
|
317
|
-
# If
|
318
|
-
if
|
323
|
+
# If verbose mode is enabled, show detailed information
|
324
|
+
if verbosity >= 1 and valid_statuses:
|
319
325
|
print("\nDetailed Runtime Status:")
|
320
326
|
print("-" * 50)
|
321
327
|
|
@@ -351,6 +357,14 @@ def status_command(args: argparse.Namespace) -> int:
|
|
351
357
|
print(
|
352
358
|
f" - Session '{session_name}': {computations} computations, {symbols} symbols"
|
353
359
|
)
|
360
|
+
# At -vv level, show the actual lists
|
361
|
+
if verbosity >= 2:
|
362
|
+
comp_list = session.get("computation_list", [])
|
363
|
+
symbol_list = session.get("symbol_list", [])
|
364
|
+
if comp_list:
|
365
|
+
print(f" Computations: {comp_list}")
|
366
|
+
if symbol_list:
|
367
|
+
print(f" Symbols: {symbol_list}")
|
354
368
|
elif not sessions:
|
355
369
|
print(" - No active sessions")
|
356
370
|
|
@@ -381,10 +395,11 @@ def main() -> int:
|
|
381
395
|
"--config", "-c", required=True, help="Path to the YAML configuration file"
|
382
396
|
)
|
383
397
|
status_parser.add_argument(
|
384
|
-
"--
|
385
|
-
"-
|
386
|
-
action="
|
387
|
-
|
398
|
+
"--verbose",
|
399
|
+
"-v",
|
400
|
+
action="count",
|
401
|
+
default=0,
|
402
|
+
help="Increase verbosity: -v for session details, -vv for full lists",
|
388
403
|
)
|
389
404
|
status_parser.set_defaults(func=status_command)
|
390
405
|
|
mplang/runtime/server.py
CHANGED
@@ -384,6 +384,11 @@ def get_session_symbol(session_name: str, symbol_name: str) -> SymbolResponse:
|
|
384
384
|
status_code=404, detail=f"Symbol {symbol_name} not found"
|
385
385
|
)
|
386
386
|
|
387
|
+
# symbol data is None means this party does not participate the computation
|
388
|
+
# that produced the symbol.
|
389
|
+
if symbol.data is None:
|
390
|
+
raise ResourceNotFound(f"Symbol '{symbol_name}' has no data on this party")
|
391
|
+
|
387
392
|
# Serialize using Value envelope
|
388
393
|
return SymbolResponse(
|
389
394
|
name=symbol.name,
|
mplang/runtime/session.py
CHANGED
@@ -272,10 +272,9 @@ class Session:
|
|
272
272
|
f"Expected {len(output_names)} results, got {len(results)}"
|
273
273
|
)
|
274
274
|
for name, val in zip(output_names, results, strict=True):
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
if not isinstance(val, Value):
|
275
|
+
# In pure SIMP model, all nodes should have the same symbol table.
|
276
|
+
# Non-participating nodes get None values.
|
277
|
+
if val is not None and not isinstance(val, Value):
|
279
278
|
raise TypeError(
|
280
279
|
"Session executions must produce kernel Value outputs; "
|
281
280
|
f"got {type(val).__name__} for symbol '{name}'"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mplang-nightly
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.dev176
|
4
4
|
Summary: Multi-Party Programming Language
|
5
5
|
Author-email: SecretFlow Team <secretflow-contact@service.alipay.com>
|
6
6
|
License: Apache License
|
@@ -271,13 +271,13 @@ def millionaire():
|
|
271
271
|
return z
|
272
272
|
|
273
273
|
# Set up a local simulator with 2 parties
|
274
|
-
sim = mplang.Simulator(2)
|
274
|
+
sim = mplang.Simulator.simple(2)
|
275
275
|
|
276
276
|
# Evaluate the compiled function
|
277
|
-
result = mplang.
|
277
|
+
result = mplang.evaluate(sim, millionaire)
|
278
278
|
|
279
|
-
# Securely fetch the result
|
280
|
-
print("Is Alice poorer than Bob?",
|
279
|
+
# Securely fetch the result (reveals SPU value)
|
280
|
+
print("Is Alice poorer than Bob?", mpd.fetch(sim, result))
|
281
281
|
```
|
282
282
|
|
283
283
|
## Learn More
|
@@ -52,7 +52,7 @@ mplang/protos/v1alpha1/mpir_pb2.pyi,sha256=dLxAtFW7mgFR-HYxC4ExI4jbtEWUGTKBvcKhI
|
|
52
52
|
mplang/protos/v1alpha1/value_pb2.py,sha256=V9fqQTqXNo2efYmlP9xOhC7EpjBUp5jL-05yrJsAvWU,2785
|
53
53
|
mplang/protos/v1alpha1/value_pb2.pyi,sha256=47GVvuZfiV5oaVemwh0xTfns8OYTVBT8YnluIQeQPbs,7108
|
54
54
|
mplang/runtime/__init__.py,sha256=IRPP3TtpFC4iSt7_uaq-S4dL7CwrXL0XBMeaBoEYLlg,948
|
55
|
-
mplang/runtime/cli.py,sha256
|
55
|
+
mplang/runtime/cli.py,sha256=-YufmwPSxo8edG_tGQaiw3H1OARtM6rGXwlQTr3uj-Y,15342
|
56
56
|
mplang/runtime/client.py,sha256=v73cFnwN7ePaGJmPi20waizeIq6dlJTjEs6OkybSR2M,15858
|
57
57
|
mplang/runtime/communicator.py,sha256=P5nl3wxRomUafoAj-1FSgD7phelof399deitVB1JMos,3508
|
58
58
|
mplang/runtime/data_providers.py,sha256=GX10_nch8PmEyok32mSC4p5rDowvmXrJ-4J5-LvY6ig,8206
|
@@ -60,8 +60,8 @@ mplang/runtime/driver.py,sha256=c7c4ULmMln5GwkK17cPyc-45XrQbprwSt7HnEaIQfcc,1172
|
|
60
60
|
mplang/runtime/exceptions.py,sha256=c18U0xK20dRmgZo0ogTf5vXlkix9y3VAFuzkHxaXPEk,981
|
61
61
|
mplang/runtime/http_api.md,sha256=-re1DhEqMplAkv_wnqEU-PSs8tTzf4-Ml0Gq0f3Go6s,4883
|
62
62
|
mplang/runtime/link_comm.py,sha256=ZHNcis8QDu2rcyyF3rhpxMiJDkczoMA_c0iZ2GDW_bA,2793
|
63
|
-
mplang/runtime/server.py,sha256=
|
64
|
-
mplang/runtime/session.py,sha256=
|
63
|
+
mplang/runtime/server.py,sha256=OqqoY6JH4Fq0QwjQkEGSqfr4MsLUrbVhu1VNJV9QEpY,16788
|
64
|
+
mplang/runtime/session.py,sha256=ZthW12tP44Wjj1uG_omXhrb2SG2t8-SNgV4Yw39H9UY,10701
|
65
65
|
mplang/runtime/simulation.py,sha256=wz47a1sskgBlt_xVPvZn7vO9-XGJ94CK5muxPZoZaRk,11623
|
66
66
|
mplang/simp/__init__.py,sha256=2WE4cmW96Xkzyq2yRRYNww4kZ5o6u6NbPV0BxqZG698,581
|
67
67
|
mplang/simp/api.py,sha256=apxrfPbAqtUGUT-C6GMwJDg32KHSkMb9aaxjeUqVksw,3613
|
@@ -74,8 +74,8 @@ mplang/utils/crypto.py,sha256=rvPomBFtznRHc3RPi6Aip9lsU8zW2oxBqGv1K3vn7Rs,1052
|
|
74
74
|
mplang/utils/func_utils.py,sha256=vCJcZmu0bEbqhOQKdpttV2_MBllIcPSN0b8U4WjNGGo,5164
|
75
75
|
mplang/utils/spu_utils.py,sha256=S3L9RBkBe2AvSuMSQQ12cBY5Y1NPthubvErSX_7nj1A,4158
|
76
76
|
mplang/utils/table_utils.py,sha256=aC-IZOKkSmFkpr3NZchLM0Wt0GOn-rg_xHBHREWBwAU,2202
|
77
|
-
mplang_nightly-0.1.
|
78
|
-
mplang_nightly-0.1.
|
79
|
-
mplang_nightly-0.1.
|
80
|
-
mplang_nightly-0.1.
|
81
|
-
mplang_nightly-0.1.
|
77
|
+
mplang_nightly-0.1.dev176.dist-info/METADATA,sha256=a4y3HgXdrhVv5OOKYyjuGnE61vDUDwQC2xU6sX98ZBs,16575
|
78
|
+
mplang_nightly-0.1.dev176.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
79
|
+
mplang_nightly-0.1.dev176.dist-info/entry_points.txt,sha256=mG1oJT-GAjQR834a62_QIWb7litzWPPyVnwFqm-rWuY,55
|
80
|
+
mplang_nightly-0.1.dev176.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
81
|
+
mplang_nightly-0.1.dev176.dist-info/RECORD,,
|
File without changes
|
{mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/entry_points.txt
RENAMED
File without changes
|
{mplang_nightly-0.1.dev174.dist-info → mplang_nightly-0.1.dev176.dist-info}/licenses/LICENSE
RENAMED
File without changes
|