apache / apache/dolphinscheduler-sdk-python
[impv] Auto create resource when set resource in task if there are exist files in local system
- 主要言語
- Python
- スター
- 71
- フォーク
- 26
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
```python
# [start workflow]
from pydolphinscheduler.core import Workflow
from pydolphinscheduler.core.resource import Resource
from pydolphinscheduler.tasks import Shell
dependence = "dependence.py"
main = "main.py"
with Workflow(
name="multi_resources_example",
# [start create_new_resources]
resource_list=[
Resource(
name=dependence,
content="from datetime import datetime\nnow = datetime.now()",
),
Resource(name=main, content="from dependence import now\nprint(now)"),
],
# [end create_new_resources]
) as workflow:
# [start use_exists_resources]
task_use_resource = Shell(
name="use-resource",
command=f"python {main}",
resource_list=[
dependence,
main,
],
)
# [end use_exists_resources]
workflow.run()
# [end workflow]
```
Change the above usage to the following usage
```python
# [start workflow]
from pydolphinscheduler.core import Workflow
from pydolphinscheduler.core.resource import Resource, LocalResource
from pydolphinscheduler.tasks import Shell
dependence = "dependence.py"
main = "main.py"
with Workflow(
name="multi_resources_example",
) as workflow:
# [start use_exists_resources]
task_use_resource = Shell(
name="use-resource",
command=f"python {main}",
resource_list=[
LocalResource('dependence.py'),
LocalResource('main.py'),
LocalResource('*.py'),
],
)
# [end use_exists_resources]
workflow.run()
# [end workflow]
```
コントリビューションガイド
調査の方向性
Resource と LocalResource のエントリポイント、および issue に示されている Shell resource_list の使用箇所から始めてください。タスク作成時にローカルリソース名と glob パターンがどのように処理されるかを追跡してください。Workflow リソース resource_list をあらかじめ定義しなくても、'*.py' を含むローカルファイルを LocalResource 経由で渡せるようになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100