Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[Question] Behaviour when receiving a struct / dataclass #9

Open
MrSaints opened this issue Dec 18, 2019 · 1 comment
Open

[Question] Behaviour when receiving a struct / dataclass #9

MrSaints opened this issue Dec 18, 2019 · 1 comment

Comments

@MrSaints
Copy link

MrSaints commented Dec 18, 2019

We are considering implementing activities in Python, and workflows in Go. When calling activities in Go, it is possible to pass a struct to the activity (e.g. https://github.com/uber-common/cadence-samples/blob/56c4ffffd38e8596075c56f03f82c5a80ae77b92/cmd/samples/fileprocessing/activities.go). We are curious about what the behaviour is like when the activity is implemented using this Python client. Judging from

def json_to_args(jsonb: bytes) -> typing.Optional[list]:
, it seems like the argument will simply be a Python dictionary. If this is the case, are there any plans for automatically converting this to say a Python dataclass?

The use-case for using a single parameter (much like a single message) activity is for versioning. It has been mentioned several times, and the solution seems to always point to this approach for dealing with an activity's contract.

@firdaus
Copy link
Owner

firdaus commented Dec 21, 2019

I missed this requirement. Thanks for bringing this to my attention. At the moment everything becomes a Python primitive, list or dictionary.

I'll add this to 1.1 release. It should be fairly trivial to support as long as the activity method is type annotated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants