apache / apache/dolphinscheduler-sdk-python
[impv] Auto create resource when set resource in task if there are exist files in local system
- Ngôn ngữ chính
- Python
- Star
- 71
- Fork
- 26
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
```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]
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với các entry point Resource và LocalResource, cùng cách sử dụng Shell resource_list được nêu trong issue. Theo dõi cách tên tài nguyên cục bộ và các mẫu glob được xử lý khi một task được tạo. Hoàn thành khi có thể cung cấp các tệp cục bộ thông qua LocalResource, bao gồm '*.py', mà không cần định nghĩa resource_list của Workflow trước.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100