Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
- kubernetes (用于部署服务-k8s方式)
- Helm (用于部署服务-k8s方式)

### Docker一键部署
```shell
wget -qO docker-compose.yml https://raw.githubusercontent.com/ModelEngine-Group/DataMate/refs/heads/main/deployment/docker/datamate/docker-compose.yml \
&& REGISTRY=ghcr.io/modelengine-group/ docker compose up -d
```

### 拉取代码

```bash
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ If you like this project, please give it a Star⭐️!
- Kubernetes (for service deployment - k8s method)
- Helm (for service deployment - k8s method)

### Docker Quick deploy
```shell
wget -qO docker-compose.yml https://raw.githubusercontent.com/ModelEngine-Group/DataMate/refs/heads/main/deployment/docker/datamate/docker-compose.yml \
&& REGISTRY=ghcr.io/modelengine-group/ docker compose up -d
```

### Clone the Code

```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ private void addFile(String sourPath, String targetPath, boolean softAdd) {
}

try {
if (Files.exists(target) && Files.isSameFile(source, target)) {
return;
}

Path parent = target.getParent();
// 创建目标目录(如果需要)
if (parent != null) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/public/config/error-code.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"cleaning.0009": "设置解析错误",
"cleaning.0010": "任务ID不能为空",
"operator.0001": "算子不存在",
"operator.0002": "算子正在使用中",
"operator.0002": "算子被编排于模版中或处在正在进行的任务中,无法删除",
"operator.0003": "无法删除预置算子",
"operator.0004": "不支持的文件类型",
"operator.0004": "不支持的文件类型,当前仅支持tar和zip",
"operator.0005": "解析算子包失败",
"operator.0006": "缺少必要的字段",
"400": "请求参数错误",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/SearchControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export function SearchControls({
<div className="flex items-center justify-between">
<div className="flex items-center gap-2 flex-wrap flex-1">
<span className="text-sm font-medium text-gray-700">
{t('components.searchControls.selectedFilters')}
{t('components.searchControls.filters.label')}
</span>
{Object.entries(selectedFilters).map(([filterKey, values]) =>
values.map((value) => {
Expand Down Expand Up @@ -231,7 +231,7 @@ export function SearchControls({
onClick={handleClearAllFilters}
className="text-gray-500 hover:text-gray-700"
>
{t('components.searchControls.clearAll')}
{t('components.searchControls.filters.clearAll')}
</Button>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/OperatorMarket/operator.const.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const mapOperator = (op: OperatorI, t: (key: string) => string) => {
const FUNCTION_CATEGORY_IDS = {
cleaning: "8c09476a-a922-418f-a908-733f8a0de521",
annotation: "cfa9d8e2-5b5f-4f1e-9f12-1234567890ab",
system: "96a3b07a-3439-4557-a835-525faad60ca3"
} as const;

const categories = op?.categories || [];
Expand Down Expand Up @@ -142,7 +143,7 @@ export const mapOperator = (op: OperatorI, t: (key: string) => string) => {
},
{
label: t("operatorMarket.const.size"),
value: formatBytes(op?.fileSize),
value: categories?.includes(FUNCTION_CATEGORY_IDS.system) ? '-' : formatBytes(op?.fileSize),
},
{
label: t("operatorMarket.const.language"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ async def create_task(

await self.operator_instance_repo.insert_instance(db, task_id, request.instance)

# Increment operator usage count
operator_ids = [inst.id for inst in request.instance if inst.id]
if operator_ids:
await self.operator_service.increment_usage_count(operator_ids, db)

all_operators = await self.operator_service.get_operators(db=db, page=0, size=1000, categories=[], keyword=None, is_star=None)
operator_map = {op.id: op for op in all_operators}

Expand Down
4 changes: 4 additions & 0 deletions runtime/datamate-python/app/module/operator/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
CATEGORY_DATAMATE_ID = "431e7798-5426-4e1a-aae6-b9905a836b34"
CATEGORY_DATA_JUICER_ID = "79b385b4-fde8-4617-bcba-02a176938996"
CATEGORY_OTHER_VENDOR_ID = "f00eaa3e-96c1-4de4-96cd-9848ef5429ec"
CATEGORY_CLEANING_ID = "8c09476a-a922-418f-a908-733f8a0de521"
CATEGORY_ANNOTATION_ID = "cfa9d8e2-5b5f-4f1e-9f12-1234567890ab"

# Category mapping
CATEGORY_MAP = {
Expand All @@ -42,6 +44,8 @@
"all": CATEGORY_ALL_ID,
"datamate": CATEGORY_DATAMATE_ID,
"data-juicer": CATEGORY_DATA_JUICER_ID,
"cleaning": CATEGORY_CLEANING_ID,
"annotation": CATEGORY_ANNOTATION_ID,
}

# File paths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from typing import Dict, Any, Optional

from app.module.operator.schema import OperatorDto, OperatorReleaseDto
from app.module.operator.constants import CATEGORY_MAP, CATEGORY_OTHER_VENDOR_ID, CATEGORY_CUSTOMIZED_ID
from app.module.operator.constants import CATEGORY_MAP, CATEGORY_OTHER_VENDOR_ID, CATEGORY_CUSTOMIZED_ID, \
CATEGORY_CLEANING_ID
from app.module.operator.exceptions import FieldNotFoundError


Expand Down Expand Up @@ -86,12 +87,22 @@ def parse_yaml(
operator.releases = [operator_release]

# Build categories
categories = [
categories = []
types = content.get("types")
if isinstance(types, list):
for t in types:
if self._to_lower(t) in CATEGORY_MAP:
categories.append(CATEGORY_MAP[self._to_lower(t)])
if len(categories) == 0:
categories.append(CATEGORY_CLEANING_ID)

categories.extend([
CATEGORY_MAP.get(self._to_lower(content.get("language")), ""),
CATEGORY_MAP.get(self._to_lower(content.get("modal")), ""),
CATEGORY_MAP.get(self._to_lower(content.get("vendor")), CATEGORY_OTHER_VENDOR_ID),
CATEGORY_CUSTOMIZED_ID,
]
])

operator.categories = categories

return operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import List, Optional
from datetime import datetime, timezone

from sqlalchemy import select, text, update
from sqlalchemy import select, text, update, func
from sqlalchemy.ext.asyncio import AsyncSession

from app.db.models.operator import Operator
Expand Down Expand Up @@ -115,7 +115,7 @@ async def increment_usage_count(
update(Operator)
.where(Operator.id.in_(operator_ids))
.values(
usage_count=Operator.usage_count + 1,
updated_at=datetime.now(timezone.utc),
usage_count=func.coalesce(Operator.usage_count, 0) + 1,
updated_at=datetime.utcnow(),
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,14 @@ def _get_upload_path(self, file_name: str) -> str:
"""获取上传文件路径"""
return os.path.join(OPERATOR_BASE_PATH, UPLOAD_DIR, file_name)

async def increment_usage_count(
self,
operator_ids: List[str],
db: AsyncSession
) -> None:
"""增加算子使用次数"""
await self.operator_repo.increment_usage_count(operator_ids, db)

def _get_extract_path(self, file_stem: str) -> str:
"""获取解压路径"""
return os.path.join(OPERATOR_BASE_PATH, EXTRACT_DIR, file_stem)
16 changes: 13 additions & 3 deletions runtime/ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ operator_package/
| `inputs` | 输入的数据模态 (text/image/audio/video) | text |
| `outputs` | 输出的数据模态 (text/image/audio/video) | text |

### 2.2 算子版本更新日志 (release)
### 2.2 算子功能分类

定义算子功能分类,支持清洗与标注。

```yaml
types:
- 'cleaning'
- 'annotation'
```

### 2.3 算子版本更新日志 (release)

定义算子当前版本较上版本更新内容。

Expand All @@ -46,7 +56,7 @@ release:
- '支持基本处理操作'
```

### 2.2 运行时资源与指标 (runtime & metrics)
### 2.4 运行时资源与指标 (runtime & metrics)

定义算子运行时的资源配额及性能指标参考。

Expand All @@ -65,7 +75,7 @@ metrics: # 算子性能参考指标
metric: '99.5%'
```

### 2.3 参数设置 (settings) - UI 组件规范
### 2.5 参数设置 (settings) - UI 组件规范

通过 `settings` 字段,开发者可以自定义用户在前端界面配置算子时的交互组件。系统支持以下类型:

Expand Down
Binary file modified runtime/ops/examples/test_operator/README.md
Binary file not shown.
3 changes: 3 additions & 0 deletions runtime/ops/examples/test_operator/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ version: '1.0.0'
modal: 'text' # text/image/audio/video/multimodal
inputs: 'text' # text/image/audio/video/multimodal
outputs: 'text' # text/image/audio/video/multimodal
types:
- 'cleaning'
- 'annotation'
release:
- '首次发布'
- '支持基本处理操作'
Expand Down
Binary file modified runtime/ops/examples/test_operator/test_operator.tar
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/images/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FROM nginx:1.29 AS runner
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt update \
&& apt install -y dos2unix python3 python3-dev python3-venv libaugeas-dev gcc \
&& apt install -y dos2unix python3 python3-dev python3-venv libaugeas-dev gcc vim cron \
&& python3 -m venv /opt/certbot/ \
&& /opt/certbot/bin/pip install --upgrade pip \
&& /opt/certbot/bin/pip install certbot certbot-nginx \
Expand Down
10 changes: 7 additions & 3 deletions scripts/images/frontend/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ if [ -f "/cert/server.pem" ]; then
fi

if [ -f "/cert/server.key" ]; then
if openssl rsa -in /cert/server.key -passin pass:test_check -noout 2>/dev/null; then
cp /cert/server.key /etc/nginx/cert/server.key
# Check if key is encrypted and decrypt if needed
# Supports RSA, EC (Elliptic Curve), PKCS#8, and DSA keys
if grep -q "ENCRYPTED" /cert/server.key 2>/dev/null; then
# Key is encrypted, decrypt using generic pkey command (supports all key types)
echo "$CERT_PASS" | openssl pkey -in /cert/server.key -out /etc/nginx/cert/server.key -passin stdin
else
echo "$CERT_PASS" | openssl rsa -in /cert/server.key -out /etc/nginx/cert/server.key -passin stdin
# Key is not encrypted, copy directly
cp /cert/server.key /etc/nginx/cert/server.key
fi
chown nginx:nginx /etc/nginx/cert/server.key
fi
Expand Down
Loading