conductor-oss / conductor-oss/python-sdk

ConductorWorkflow requires a live executor at construction time — prevents offline use

Đang mở
#432 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
104
Fork
42
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
3

Mô tả

## Summary

Tested against: **Conductor OSS 3.32.0-rc.9**

`ConductorWorkflow.__init__()` takes `executor: WorkflowExecutor` as a mandatory
first positional argument. This forces a live server connection at the point of
constructing a workflow definition, making offline use impossible.

## Impact

- **Unit testing**: tests that validate workflow structure (task order, task types,
inputParameters) cannot be written without a running Conductor server.
- **Library code**: functions that return workflow definitions must thread an
`executor` parameter through all their call chains, coupling definition logic
to connection management.
- **Code generation / serialization**: workflow definitions cannot be built and
exported to JSON without a server connection.

## Reproduction

```python
# Fails without a server running:
wf = ConductorWorkflow(name="my_wf", version=1)
# TypeError: ConductorWorkflow.__init__() missing 1 required positional argument: 'executor'

# Required:
config = Configuration(server_api_url="http://localhost:8080/api")
executor = WorkflowExecutor(config)
wf = ConductorWorkflow(executor=executor, name="my_wf", version=1)
```

## Suggested fix

Make `executor` optional; raise `RuntimeError` only when an executor-dependent
method (`.register()`, `.start_workflow()`, `.execute()`) is called on a workflow
with no executor set:

```python
def __init__(self, name: str, version: Optional[int] = None,
executor: Optional[WorkflowExecutor] = None, ...):
self._executor = executor
...

def register(self, overwrite: bool):
if self._executor is None:
raise RuntimeError("ConductorWorkflow.register() requires an executor. "
"Pass executor= at construction time.")
...
```

## Verified against

Conductor server **3.32.0-rc.9**, Python SDK (editable install from
`conductor-oss/python-sdk` main branch).

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

Hướng nghiên cứu

Tìm ConductorWorkflow.__init__(), sau đó kiểm tra register(), start_workflow() và execute() cùng với cách xử lý WorkflowExecutor hiện có. Tái hiện việc khởi tạo mà không có server, sau đó xác minh rằng các lời gọi phụ thuộc vào executor sẽ thất bại một cách rõ ràng khi không có server, trong khi việc sử dụng có executor hỗ trợ vẫn hoạt động.

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
backend-api-design
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.