dagster-code-location-structure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDagster Code Location Structure
Dagster代码位置结构
Project layout
项目布局
Code locations live under as separate subdirectories, each managed
by . Shared code (base classes, utilities, sensors used by multiple locations)
lives in .
dg_projects/dgpackages/ol-orchestrate-lib/dg_projects/
<code_location_name>/
pyproject.toml
src/
<code_location_name>/
assets/
sensors/
...
packages/
ol-orchestrate-lib/
...代码位置作为独立子目录存放在下,每个子目录由管理。共享代码(基础类、工具函数、多个位置共用的sensors)存放在中。
dg_projects/dgpackages/ol-orchestrate-lib/dg_projects/
<code_location_name>/
pyproject.toml
src/
<code_location_name>/
assets/
sensors/
...
packages/
ol-orchestrate-lib/
...Scaffolding new code locations
搭建新的代码位置
Use the tool to scaffold new code locations — not :
create-dagsterdg scaffoldbash
create-dagster <code_location_name>使用工具搭建新的代码位置——不要使用:
create-dagsterdg scaffoldbash
create-dagster <code_location_name>Asset and sensor placement
资产与传感器的放置
Assets and sensors must be placed in the code location that owns them. Do not
accidentally include an asset or sensor from one code location in another.
When migrating or moving definitions, double-check /
imports in each code location.
defs.py__init__.pyAssets和sensors必须放在所属的代码位置中。切勿将一个代码位置的asset或sensor错误地包含到另一个位置中。迁移或移动定义时,请仔细检查每个代码位置中的 / 导入语句。
defs.py__init__.pyMigration sequencing
迁移顺序
When migrating multiple code locations (e.g., from EC2/docker-compose to
Kubernetes), do one code location at a time. The first location becomes the
validated template. Never try to migrate all locations in a single PR.
当迁移多个代码位置时(例如从EC2/docker-compose迁移到Kubernetes),每次只迁移一个代码位置。第一个迁移的位置将作为验证后的模板。切勿尝试在单个PR中迁移所有位置。
Shared OAuth / base classes
共享OAuth/基础类
The module inside is used as a base class by
multiple code locations. It must remain in the library even if it looks unused
from a single code location's perspective.
oauthol-orchestrate-libol-orchestrate-liboauthChecking partitions
检查分区
Static partitions with hardcoded values are the old approach. Prefer
dynamic/time-based partitions when an up-to-date implementation already exists
in another code location — copy that pattern rather than the older one.
使用硬编码值的静态分区是旧方法。如果其他代码位置中已有最新的动态/基于时间的分区实现,请优先使用该模式,而非旧模式。