temporalio / temporalio/samples-python
[Feature Request] Guide against single-file structure
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 367
- Fork
- 121
- Merge trung bình
- 3 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
Is your feature request related to a problem? Please describe.
Given this single-file pattern of running a Workflow inside a Worker:
there is potential (and one past instance I know of) for people learning based off of samples to think that in order to run a Workflow, you need to run it inside an async with Worker. When they try to develop an application based on that paradigm, they run into a number of issues.
Describe the solution you'd like
Make it clear that when developing, we recommend:
- running a worker separately from workflows
- defaulting to a single worker for all workflows, not one worker per workflow
We could make it clear by structuring all samples that way. OTOH I like the brevity of the single file samples. Another possibility is changing the comment. The drawbacks to that are:
- some people don't read comments
- the comment might not be clear, unless you point to a multi-file sample, what exactly we recommend doing
Comment is currently:
# While the worker is running, use the client to run the workflow and
# print out its result. Note, in many production setups, the client
# would be in a completely separate process from the worker.
Perhaps could be:
# Use the client to run the workflow and print out its result.
# NOTE: when developing, we recommend starting out running a
# single worker that has all your workflow and activities and
# running client code in a separate process. See, for example,
# how the encryption sample has a separate files to run:
# worker.py runs the worker and starter.py uses the client.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với hello/hello_activity.py, các dòng 47-64, và so sánh thiết lập Worker và workflow trong một tệp duy nhất của nó với worker.py và starter.py trong mẫu mã hóa. Quyết định xem hướng dẫn nên nằm trong cấu trúc mẫu hay trong các chú thích, sau đó cập nhật các mẫu liên quan để các tiến trình Worker và client riêng biệt, với một Worker phục vụ workflows, được thể hiện rõ ràng và nhất quán.
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
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 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