conductor-oss / conductor-oss/python-sdk

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

Aperta
#432 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
104
Fork
42
Merge medio
2g 1h
PR unite (30g)
3

Descrizione

## 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).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Locate ConductorWorkflow.__init__(), then inspect register(), start_workflow(), and execute() along with the existing WorkflowExecutor handling. Reproduce construction without a server, then verify executor-dependent calls fail clearly without one while executor-backed use still works.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend-api-design
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.