Project

Profile

Help

Story #1019

closed

Add ScheduleID to Tasks spawned by schedulers

Added by mkovacik@redhat.com over 9 years ago. Updated over 4 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

At the moment, one can't link schedule-spawned tasks to their particular schedule.
As a result, one can't tell easily whether e.g. scheduled unit install works or whether to delete/reconfigure it because of a malformed unit key.
This makes it difficult for automated tests (or other API consumer) to check spawned tasks progress/status explicitly.
I therefore suggest adding a link from the spawned task back to the scheduler object instance (another tag possibly).

Scheduled regular Unit installation object
[root@ip-172-31-20-145 ~]# curl -k https://admin:admin@localhost/pulp/api/v2/consumers/SimpleScheduledInstall_consumer/schedules/content/install/ | python -mjson.tool

[
    {
        "_href": "/pulp/api/v2/consumers/SimpleScheduledInstall_consumer/schedules/content/install/556863872bcb1c2d440c0ef1/", 
        "_id": "556863872bcb1c2d440c0ef1", 
        "args": [
            "SimpleScheduledInstall_consumer"
        ], 
        "consecutive_failures": 0, 
        "enabled": true, 
        "failure_threshold": 3, 
        "first_run": "2015-05-29T13:03:03Z", 
        "kwargs": {
            "options": null, 
            "units": [
                {
                    "type_id": "rpm", 
                    "unit_key": "pike"
                }
            ]
        }, 
        "last_run_at": "2015-05-29T14:07:03Z", 
        "last_updated": 1432904583.9740551, 
        "next_run": "2015-05-29T14:08:03Z", 
        "options": null, 
        "remaining_runs": null, 
        "resource": "pulp:consumer:SimpleScheduledInstall_consumer", 
        "schedule": "PT1M", 
        "task": "pulp.server.tasks.consumer.install_content", 
        "total_run_count": 65, 
        "units": [
            {
                "type_id": "rpm", 
                "unit_key": "pike"
            }
        ]
    }
]

Task spawned by the scheduler to install the unit, failing because of malformed unit key
curl -k https://admin:admin@localhost/pulp/api/v2/tasks/ | python -mjson.tool | less

    {
        "_href": "/pulp/api/v2/tasks/9cbab540-9a1b-4636-b8f6-5928456eeac1/", 
        "_id": {
            "$oid": "55681cb92bcb1c238ad7a30e"
        }, 
        "_ns": "task_status", 
        "error": null, 
        "exception": null, 
        "finish_time": "2015-05-29T08:00:57Z", 
        "id": "55681cb92bcb1c238ad7a30e", 
        "progress_report": null, 
        "result": null, 
        "spawned_tasks": [], 
        "start_time": "2015-05-29T08:00:57Z", 
        "state": "error", 
        "tags": [
            "pulp:consumer:SimpleScheduledInstall_consumer", 
            "pulp:action:unit_install"
        ], 
        "task_id": "9cbab540-9a1b-4636-b8f6-5928456eeac1", 
        "task_type": null, 
        "traceback": "Traceback (most recent call last):\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/agent.py\", line 137, in __call__\n    response = self.request_to_call(self.module, request, self.PROFILE)()\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/agent.py\", line 118, in <lambda>\n    **dict(list(request['kws'].viewitems()) + [('PROFILE', PROFILE)])\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/handler.py\", line 19, in logged_wrapper\n    ret = method(self, *args, **kvs)\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/handler.py\", line 47, in wrapped_method\n    units\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/handler.py\", line 45, in <lambda>\n    PROFILE\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/content_handler.py\", line 29, in install\n    unit_type.store(unit, PROFILE)\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/rpm_unit.py\", line 46, in store\n    if Rpm.list(unit, PROFILE) == []:\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/rpm_unit.py\", line 34, in list\n    nevra = Rpm.unit_to_nevra(unit)\n  File \"/home/mkovacik/src/pulp-automation/pulp_auto/handler/rpm_unit.py\", line 14, in unit_to_nevra\n    'name':  request.unit_key.name,\nAttributeError: 'unicode' object has no attribute 'name'\n", 
        "worker_name": "agent"
    }

Also available in: Atom PDF