Skip to content

EventData is not pickeable and can't work with multiprocessing Pool #15772

@jelther

Description

@jelther
  • Package Name: azure-eventhub
  • Package Version: 5.2.0
  • Operating System: Ubuntu 20.04
  • Python Version: 3.8

Describe the bug
Object EventData is not pickeable, thus it is not possible to process them in a process pool.

To Reproduce
Steps to reproduce the behavior:

from multiprocessing import Pool
from typing import List
from azure.eventhub import EventData

def build_event_data(i):
	return EventData(body=f'{i}')

if __name__ == "__main__":
	with Pool() as p:
		eventdata : List[EventData] = p.map(build_event_data,[(i) for i in range(10)])

Expected behavior
It's expected that eventdata holds a list of all events created in parallel.

Exception Raised

multiprocessing.pool.MaybeEncodingError: Error sending result: '[EventData(body='0', properties={}, offset=None, sequence_number=None, partition_key=None, enqueued_time=None)]'. Reason: 'TypeError('no default __reduce__ due to non-trivial __cinit__')'

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Event HubsP0customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions