pulp / pulp/pulpcore

Task.error dict does not include a type

Open
#2,073 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue
Dominant language
Python
Stars
598
Forks
168
Avg merge
1d 4h
Merged PRs (30d)
86

Description

Author: @dkliban (dkliban@redhat.com)

Redmine Issue: 9659, https://pulp.plan.io/issues/9659


MemoryError does not have a message string. So when the error shows up in a Task, the description is an empty string and only a traceback is present. The Task.error dict should include a type key[0].

{
    "child_tasks": [],
    "created_resources": [],
    "error": {
        "description": "",
        "traceback": "  File \"/usr/lib/python3.6/site-packages/pulpcore/tasking/pulpcore_worker.py\", line 317, in _perform_task\n    result = func(*args, **kwargs)\n  File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/importer.py\", line 161, in import_repository_version\n    a_result = _import_file(os.path.join(rv_path, filename), res_class, do_raise=False)\n  File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/importer.py\", line 62, in _import_file\n    data = Dataset().load(json_file.read(), format=\"json\")\n  File \"/usr/lib/python3.6/site-packages/tablib/core.py\", line 403, in load\n    stream = normalize_input(in_stream)\n  File \"/usr/lib/python3.6/site-packages/tablib/utils.py\", line 10, in normalize_input\n    return StringIO(stream)\n"
    },
    "finished_at": "2021-12-16T21:10:44.339744Z",
    "logging_cid": "5771d8b0-21d3-42b5-b4a9-2d57b29cc756",
    "name": "pulpcore.app.tasks.importer.import_repository_version",
    "parent_task": "/pulp/api/v3/tasks/79b44b66-2b76-4be8-a29a-cbe9f4122a6e/",
    "progress_reports": [
        {
            "code": "import.repo.version.content",
            "done": 0,
            "message": "Importing content for Red_Hat_Enterprise_Linux_8_for_x86_64_-_BaseOS_RPMs_8-2128169",
            "state": "running",
            "suffix": null,
            "total": null
        }
    ],
    "pulp_created": "2021-12-16T20:50:49.847379Z",
    "pulp_href": "/pulp/api/v3/tasks/d24dd8ec-bbfa-4bf8-8950-ac905bb27d30/",
    "reserved_resources_record": [
        "/pulp/api/v3/repositories/rpm/rpm/3a731cf5-a48f-4bf2-9aae-cd153cac213e/"
    ],
    "started_at": "2021-12-16T20:50:49.891657Z",
    "state": "failed",
    "task_group": "/pulp/api/v3/task-groups/13d15dcc-0889-4dff-b513-a4e2d580af03/",
    "worker": null
}

[0] https://github.com/pulp/pulpcore/blob/8f74f9098a5c2d393e4bfd3835b99df3de5a913a/pulpcore/exceptions/base.py#L44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pulpcore/exceptions/base.py at the linked exception definition, then trace how task failures are assembled into the Task.error dictionary. Reproduce or inspect the MemoryError case and verify that the resulting error response includes a type alongside description and traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.