I'm trying to enqueue a basic job in redis using django_rq, a python library for queueing jobs and processing them in the background with workers, but the simple call throws a:
AttributeError: 'dict' object has no attribute '__module__'
I've traced down the issue to this line in the rq library:
if not isinstance(f, string_types) and f.__module__ == '__main__':
raise ValueError('Functions from the __main__ module cannot be processed '
'by workers.')
I'm passing a function in as f so I dont understand how it can throw an attribute error on a dict. Any ideas on whats going wrong?
Stack Trace:
File "/Users/admin/dev/feedme-web/feedme/api/views.py", line 133, in post
parameter_dict = {
File "/Users/admin/dev/feedme-web/feedme-env/lib/python2.7/site-packages/django_rq/queues.py", line 162, in enqueue
return get_queue().enqueue(func, *args, **kwargs)
File "/Users/admin/dev/feedme-web/feedme-env/lib/python2.7/site-packages/rq/queue.py", line 159, in enqueue
if not isinstance(f, string_types) and f.__module__ == '__main__':
Function being enqueued:
def create_order_ordrin(user, card_primary_key, address_primary_key):
parameter_dict = {
"""... pararmeters for call here ..."""
}
ordrin = initialize_ordrin()
return ordrin.order_user(**parameter_dict)
* note the values user, card_primary_key, and address_primary_key are not being used yet