Affected code:
|
# Attempt upload |
|
e = MultipartEncoder(fields={ |
|
'package_id': dataset_id, |
|
'name': resource_name, |
|
'upload': (resource_name, path.open('rb'))}) |
|
m = MultipartEncoderMonitor(e, monitor_callback) |
|
# perform upload |
|
data = api.post("resource_create", |
|
data=m, |
|
dump_json=False, |
|
headers={"Content-Type": m.content_type}) |
Using package_revise instead of resource_create was @wardi's suggestion in the ckan gitter.im chat. package_revise can be used with the __extend syntax to support file uploads.
The original problem were race conditions when resources were added and at the same time package_revise was called from other threads. package_revise should be atomic if and only if only package_revise is used.
Affected code:
DCOR-Aid/dcoraid/upload/dataset.py
Lines 70 to 80 in 71097d9
Using
package_reviseinstead ofresource_createwas @wardi's suggestion in the ckan gitter.im chat.package_revisecan be used with the__extendsyntax to support file uploads.The original problem were race conditions when resources were added and at the same time
package_revisewas called from other threads.package_reviseshould be atomic if and only if onlypackage_reviseis used.