Default N=3. Use the most recent N complete calendar days in Asia/Shanghai,
converted to the UTC half-open interval [startTime, endTime). If the user
provides explicit dates, use those dates.
The business-cockpit prefix in dce is only the generated service label for
Crane. The actual HTTP paths are /apis/crane.io/v1alpha1/.... If the user
provides one model explicitly, skip model discovery and query that model.
Workflow
- Run the bundled runner directly. It first calls the Crane model-list API, then queries model revenue and cost. Do not split the workflow manually or call another DCE module:
python3 scripts/query_model_finance.py \
--hostname <host> \
--start-time <UTC-start> \
--end-time <UTC-end-exclusive>
Omit --hostname when one DCE host is already configured. The runner uses
only Python's standard library and the dce CLI, and calls Crane GET APIs
only.
-
The runner uses a fixed concurrency policy:
- Preserve the model-list order and split models into batches of at most 8.
- Use a fixed thread pool of 16 workers per batch. Each worker runs exactly one model revenue or cost request, so a full batch has at most 16 Crane GET subprocesses.
- Wait for every request in the current batch before starting the next batch.
- Each request has its own
dcesubprocess and output buffer. Workers only return values; the main thread merges results by(model, revenue/cost)and emits rows in the original model order. Do not share files or stdout. - A failed request is recorded in the relevant model
errorsobject. A model list failure is recorded as top-levelerrors.modelList. The runner still exits successfully and the skill must continue with a partial-data report.
-
Read
revenueYuanfrom the revenue response and the numeric value inkpi.valuefrom the cost response. For valid pairs calculate:gross profit = revenue - cost gross margin = gross profit / revenueDo not calculate gross margin when revenue is zero. Sort by revenue descending, display amounts in CNY yuan with two decimals, and never treat a missing cost as zero.
Output
Respond in Chinese. Put the conclusion first, prefer charts to prose, and keep the detail table compact:
## 结论
最近 N 个完整自然日:收入 ¥总收入,成本 ¥总成本,毛利 ¥总毛利,毛利率 总毛利率。
## 模型经营图
模型 收入 成本 毛利
model-a ¥收入 ██████████ ¥成本 ██████ ¥毛利 ████
model-b ¥收入 ██████ ¥成本 █████ ¥毛利 █
## 模型明细
|模型|收入|成本|毛利|毛利率|
|---|---:|---:|---:|---:|
|...|¥...|¥...|¥...|...%|
## 运营关注
- <收入/成本集中度、亏损模型或成本缺失>
Normalize each bar against the largest absolute value in its column and show at least one block for a non-empty value. If there is no valid Crane data, say so directly. Do not expose command traces, retry logs, raw JSON, or internal error details in the final report.
Run only the Crane GET queries described above; never perform writes.