44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""submit_pack.py — 提交 pack 任务: 权重+serve.py 写入数据空间 jev_sidecar_r41"""
|
|
import base64, json, sys, os
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
from mcp_call import MCP
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
BOOT = os.path.join(os.path.dirname(HERE), "bootstrap_pack.py")
|
|
|
|
def main():
|
|
code = open(BOOT, "rb").read()
|
|
b64 = base64.b64encode(code).decode()
|
|
cmd = 'python3 -c "import base64;exec(base64.b64decode(\'%s\'))"' % b64
|
|
mcp = MCP()
|
|
mcp.init()
|
|
args = {
|
|
"name": "jev-sidecar-pack-v2",
|
|
"cluster_uid": "cls_NxkCmBta",
|
|
"org_symbol": "dcloud",
|
|
"image": "ccr-29eug8s3-vpc.cnc.bj.baidubce.com/dcloud/yolov8-11:20260507-v11",
|
|
"sku_id": "6e6b40e5-75df-11f1-bb25-fa20203411cd",
|
|
"replicas": 1,
|
|
"mode": "single",
|
|
"queue": "que-1aebb78f87a1",
|
|
"resource_pool_type": "elastic",
|
|
"priority": "high",
|
|
"restart_policy": "Never",
|
|
"description": "pack: ModelScope mmBERT(1.2GB)+gitea r41 adapter重组+serve.py 写入数据空间 dataSpace/jev_sidecar_r41 (hostpath卷根挂载)",
|
|
"command": cmd,
|
|
"storage_mounts": [{"storage_type": "hostpath",
|
|
"source_path": "/var/lib/juicefs/volume",
|
|
"mount_path": "/var/lib/juicefs/volume"}],
|
|
}
|
|
out = mcp.call("submit_training_task", args, timeout=180)
|
|
for c in (out if isinstance(out, list) else [out]):
|
|
if isinstance(c, dict) and c.get("type") == "text":
|
|
print(c.get("text", ""))
|
|
else:
|
|
print(json.dumps(c, ensure_ascii=False))
|
|
mcp.close()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|