{"id":31970403,"url":"https://github.com/symphony09/ograph","last_synced_at":"2025-10-14T19:14:52.823Z","repository":{"id":214629735,"uuid":"736967581","full_name":"symphony09/ograph","owner":"symphony09","description":"【Go DAG Schedule Framework】A simple way to build a pipeline with Go.","archived":false,"fork":false,"pushed_at":"2025-05-03T13:30:24.000Z","size":119,"stargazers_count":42,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-03T14:31:08.731Z","etag":null,"topics":["cgraph","dag","framework","golang","graph","parallel-computing","pipeline","taskflow","workflow-engine"],"latest_commit_sha":null,"homepage":"https://symphony09.github.io/ograph-docs/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/symphony09.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-29T11:59:25.000Z","updated_at":"2025-05-03T13:26:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c9482d4-a757-46df-a859-6f64062fa39b","html_url":"https://github.com/symphony09/ograph","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"2dff77284bbe832148a898f47d2653b8897818c7"},"previous_names":["symphony09/ograph"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/symphony09/ograph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symphony09%2Fograph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symphony09%2Fograph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symphony09%2Fograph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symphony09%2Fograph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/symphony09","download_url":"https://codeload.github.com/symphony09/ograph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symphony09%2Fograph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020649,"owners_count":26086895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgraph","dag","framework","golang","graph","parallel-computing","pipeline","taskflow","workflow-engine"],"created_at":"2025-10-14T19:14:48.766Z","updated_at":"2025-10-14T19:14:52.817Z","avatar_url":"https://github.com/symphony09.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"                    ________________                     ______  \n                    __  __ \\_  ____/____________ ___________  /_ \n                    _  / / /  / __ __  ___/  __ `/__  __ \\_  __ \\\n                    / /_/ // /_/ / _  /   / /_/ /__  /_/ /  / / /\n                    \\____/ \\____/  /_/    \\__,_/ _  .___//_/ /_/ \n    \t\t\t                                 /_/             \n\n# OGraph: A simple way to build a pipeline with Go\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/symphony09/ograph)](https://goreportcard.com/report/github.com/symphony09/ograph)\n[![codecov](https://codecov.io/github/symphony09/ograph/graph/badge.svg?token=TR5UR9L6Y8)](https://codecov.io/github/symphony09/ograph)\n[![Go Reference](https://pkg.go.dev/badge/github.com/symphony09/ograph.svg)](https://pkg.go.dev/github.com/symphony09/ograph)\n[![DeepWiki](https://img.shields.io/badge/DeepWiki-symphony09%2Fograph-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/symphony09/ograph)\n\u003c!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ --\u003e\n\n\n[中文](README.md) | [English](README_en.md)\n\n**OGraph** 是一个用 `Go` 实现的图流程执行框架。\n\n你可以通过构建`Pipeline`(流水线)，来控制依赖元素依次顺序执行、非依赖元素并发执行的调度功能。\n\n此外，**OGraph** 还提供了丰富的重试，超时限制，执行追踪等开箱即用的特征。\n\n## 同类项目对比\n\n**OGraph** 受启发于另一个 `C++`项目 [CGraph](https://github.com/ChunelFeng/CGraph)。但 OGraph 并不等于 Go 版本的 CGraph。\n\n### 功能对比\n\n和 CGraph 一样，OGraph 也提供基本的构图和调度执行能力，但有以下几点关键不同：\n\n*   用 Go 实现，使用协程而非线程进行调度，更轻量灵活\n\n*   支持通过 Wrapper 来自定义循环、执行条件判断、错误处理等逻辑，并可以随意组合\n\n*   支持导出图结构，再在别处导入执行（符合限制的情况下）\n\n*   灵活的虚节点设置，用以简化依赖关系\n\n### 性能对比\n\n经过 Benchmark 测试，OGraph 性能优于 CGraph。\n\n[CGraph 性能测试参考](http://www.chunel.cn/archives/cgraph-compare-taskflow-v1)\n\n[OGraph 性能测试参考](docs/benchmark_report.md)\n\n\n|                          | CGraph（基准） | OGraph（本项目）     |\n| :----------------------- | :------------- | :------------------- |\n| 场景一（无连接32节点）   | 8204 ns/op     | 4308 ns/op（+90.4%） |\n| 场景二（串行连接32节点） | 572 ns/op      | 281.7 ns/op（+103%） |\n| 场景三（简单DAG 6节点）  | 4042 ns/op     | 2762 ns/op（+46.3%） |\n| 场景四（8x8全连接）      | 13450 ns/op    | 8333 ns/op（+61.4%） |\n\n\n## 快速开始\n\n### 第一步：声明一个 Node 接口实现\n\n```go\ntype Person struct {\n\tograph.BaseNode\n}\n\nfunc (person *Person) Run(ctx context.Context, state ogcore.State) error {\n\tfmt.Printf(\"Hello, i am %s.\\n\", person.Name())\n\treturn nil\n}\n```\n\n上面代码中 Person 组合了 BaseNode，并覆写了 Node 接口方法 Run。\n\n### 第二步：构建一个 Pipeline 并运行\n\n```go\nfunc TestHello(t *testing.T) {\n\tpipeline := ograph.NewPipeline()\n\n\tzhangSan := ograph.NewElement(\"ZhangSan\").UseNode(\u0026Person{})\n\tliSi := ograph.NewElement(\"LiSi\").UseNode(\u0026Person{})\n\n\tpipeline.Register(zhangSan).\n\t\tRegister(liSi, ograph.Rely(zhangSan))\n\n\tif err := pipeline.Run(context.TODO(), nil); err != nil {\n\t\tt.Error(err)\n\t}\n}\n```\n\n上面代码在 pipeline 中注册了两个 Person 节点（zhangSan、liSi），并指定 liSi 依赖于 zhangSan。\n\n输出结果\n\n    Hello, i am ZhangSan.\n    Hello, i am LiSi.\n\n## 更多文档\n\n请前往 [https://symphony09.github.io/ograph-docs](https://symphony09.github.io/ograph-docs/zh/docs/quick-start/) 查看更多文档!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsymphony09%2Fograph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsymphony09%2Fograph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsymphony09%2Fograph/lists"}