界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
部署与运维 · SKILL.md

executor-service-patterns

executor-service-patterns

【部署与运维】Build Jina Executor services, endpoints, DocArray schemas, Deployments, dynamic batching, templates, and Executor troubleshooting.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: executor-service-patterns description: "Build Jina Executor services, endpoints, DocArray schemas, Deployments, dynamic batching, templates, and Executor troubleshooting." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

Executor Service Patterns

Use this sub-skill when a task involves writing a Jina Executor, exposing @requests endpoints, serving a single service with Deployment, configuring uses_with or endpoint aliases, creating an Executor project, or debugging service startup/runtime errors.

Read first

Minimal service

from jina import Executor, Deployment, requests
from docarray import BaseDoc, DocList

class TextDoc(BaseDoc):
    text: str = ""

class UppercaseExecutor(Executor):
    @requests(on="/uppercase")
    def uppercase(self, docs: DocList[TextDoc], **kwargs) -> DocList[TextDoc]:
        for doc in docs:
            doc.text = doc.text.upper()
        return docs

with Deployment(uses=UppercaseExecutor, port=12345) as dep:
    out = dep.post(on="/uppercase", inputs=DocList[TextDoc]([TextDoc(text="hello")]), return_type=DocList[TextDoc])
    print(out[0].text)

For production, move the Executor into a module, define YAML, and start with jina deployment --uses deployment.yml.

Boundary rules

我的收藏