-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Included ingstion page works but throws errors #2
Comments
To solve the default behaviour ckanext-ingest/ckanext/ingest/views.py Lines 44 to 52 in 81dd3a0
with if data['report'] == 'details':
for ingested in result:
pkg = tk.get_action("package_show")({}, ingested['result']['result'])
tk.h.flash_success(
"Success: <a href='{url}'>{title}</a>".format(
title=pkg["title"],
url=tk.h.url_for(pkg["type"] + ".read", id=pkg["name"]),
),
True,
)
else:
tk.h.flash_success("Success: {success}</br>Failed: {fail}".format(**result), True) But a more elegant solution would be to pass the |
Out of date documentation? Lines 128 to 132 in 81dd3a0
Should this return IngestionResult instead of dict ?
|
ckanext-ingest/ckanext/ingest/views.py Line 40 in 81dd3a0
CKAN parse_params function is not compatible with the hierarchical StrategyOptions class.ckanext-ingest/ckanext/ingest/shared.py Lines 23 to 53 in 81dd3a0
It's not possible to pass the nested update_existing option this way, let alone the the form structure.
EditI've managed to get it working fine by replacing |
Thanks, good catch. This UI page is experimental and will change in the future. I'd recommend to make a copy and adapt it to your needs. But it shouldn't be so broken, indeed. I adopted your suggestions.
|
Thanks for picking this up. Sorry it's a bit of a stream of consciousness. I wanted to progress but also come back and fix it later. I figured the page was an example from which to build ones own ingestion pipeline, and it was very helpful to have, even in this state. I like your solution to not being able to pass the types out of the action. Much easier to synchronise the result data with the view. I hadn't considered the risks of rendering the package details. I mainly wanted the details for debugging and wonder if it's worth adding a check for debug/dev mode, so it only renders the details in non-production deployments? The reason I asked about using explicit type rather than Thanks for the feedback and glad you're keeping this plug-in alive. So many useful ones are 9 years abandoned. |
Preamble
While trying to figure out implementing my own ingesters I came across some issues, and updated with fixes.
Initial problem
ckanext-ingest/ckanext/ingest/views.py
Lines 42 to 44 in 81dd3a0
The result returned by
ingest_import_records({}, data)
is{'fail': 0, 'success': 1}
not a list of ids, consequently the unpack on line 44 returns the keysfail
andsuccess
and the call topackage_show({}, {"id": "fail"})
crashes out with "package not found".Looking back at ae63b57, the function that became ingest_import_records, did return a list of ids in the past.
Edit
The success/fail count is recorded in
ckanext-ingest/ckanext/ingest/artifact.py
Line 63 in 81dd3a0
ckanext-ingest/ckanext/ingest/logic/action.py
Line 91 in 81dd3a0
"details"
means the rest could be unpacked in the view as expected.The text was updated successfully, but these errors were encountered: