Azure / Azure/azure-functions-durable-python

Tuples passed in parameters are not accessible by name

Aperta
#151 13 commenti 0 reazioni 1 assegnatario Assegnata a @wenhzha Vedi su GitHub
Enhancement P2
Lingua principale
Python
Stelle
157
Fork
70
Merge medio
2g 10h
PR unite (30g)
2

Descrizione

Please note that I may be doing things wrong but it seems like it should work. I had to use deconstruction to make it work.

Please see the commented code in the activity section.

## To reproduce

```
Azure Functions Core Tools (3.0.2630 Commit hash: beec61496e1c5de8aa4ba38d1884f7b48233a7ab)
Function Runtime Version: 3.0.13901.0
```
```
Python 3.7.7
```

#### Orchestrator

```python
from collections import namedtuple
import azure.functions as func
import azure.durable_functions as df

def orchestrator_function(context: df.DurableOrchestrationContext):
Location = namedtuple('Location', ['city', 'state'])
location = Location(city='Seattle', state= 'WA')

weather = yield context.call_activity("GetWeather", location)

# ...

```
#### Activity

```python
import logging
from collections import namedtuple

Location = namedtuple('Location', ['city', 'state'])

def main(location: Location) -> str:
city, state = location
# THIS DOESN'T WORK 👇
# return f"Hello {location.city}, {location.state}!"
return f"Hello {city}, {state}!"
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.