Bug 855869

Summary: RFE: Include Task_id in event notification
Product: [Retired] Pulp Reporter: Justin Sherrill <jsherril>
Component: async/tasksAssignee: Michael Hrivnak <mhrivnak>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: MasterCC: jason.dobies, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: 2.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-08 16:02:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 854726    

Description Justin Sherrill 2012-09-10 13:18:03 UTC
Description of problem:

Currently the event notification works great, but it does not include the task_id that generated the event.

http://pulpproject.org/v2/staging/rest-api/event/crud.html#retrieve-all-event-listeners


It would be very helpful to include that so that we could track a task from inception to completion.

Comment 1 Jason Connor 2012-09-14 00:46:54 UTC
This was fixed as part of the event task info story
There is now a call_report field in the event that has a sub-field of task_id

Comment 2 Jeff Ortel 2012-09-21 18:12:57 UTC
build: 0.328

Comment 3 Preethi Thomas 2012-10-10 18:19:43 UTC
looks like this is not fixed. I don't see a task_id 

[root@pulp-master ~]curl -k -u admin:admin  "https://localhost/pulp/api/v2/events/" |json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   577  100   577    0     0   3297      0 --:--:-- --:--:-- --:--:--  3335
[
    {
        "notifier_config": {
            "addresses": [
                "preethit"
            ],
            "subject": "sync started"
        },
        "_ns": "event_listeners",
        "event_types": [
            "repo.sync.start"
        ],
        "_id": {
            "$oid": "50731d50edfc065dee00001a"
        },
        "id": "50731d50edfc065dee00001a",
        "notifier_type_id": "email",
        "_href": "/pulp/api/v2/events/"
    },
    {
        "notifier_config": {
            "addresses": [
                "preethit"
            ],
            "subject": "event"
        },
        "_ns": "event_listeners",
        "event_types": [
            "repo.publish.finish"
        ],
        "_id": {
            "$oid": "5075b98fedfc065dee000268"
        },
        "id": "5075b98fedfc065dee000268",
        "notifier_type_id": "email",
        "_href": "/pulp/api/v2/events/"
    }
]
[root@pulp-master ~]# pulp-admin -u admin -p admin tasks list+----------------------------------------------------------------------+
                                 Tasks
+----------------------------------------------------------------------+

Operations:  sync
Resources:   zoo (repository)
State:       Successful
Start Time:  Unstarted
Finish Time: 2012-10-10T18:17:46Z
Result:      Incomplete
Task Id:     c01a7291-1306-11e2-89f6-54520075d18e

Operations:  auto_publish, publish
Resources:   zoo (repository)
State:       Successful
Start Time:  Unstarted
Finish Time: 2012-10-10T18:17:47Z
Result:      Incomplete
Task Id:     c01a7538-1306-11e2-89f6-54520075d18e


[root@pulp-master ~]# pulp-admin -u admin -p admin tasks list
+----------------------------------------------------------------------+
                                 Tasks
+----------------------------------------------------------------------+

Operations:  sync
Resources:   zoo (repository)
State:       Successful
Start Time:  Unstarted
Finish Time: 2012-10-10T18:17:46Z
Result:      Incomplete
Task Id:     c01a7291-1306-11e2-89f6-54520075d18e

Operations:  auto_publish, publish
Resources:   zoo (repository)
State:       Successful
Start Time:  Unstarted
Finish Time: 2012-10-10T18:17:47Z
Result:      Incomplete
Task Id:     c01a7538-1306-11e2-89f6-54520075d18e


[root@pulp-master ~]# curl -k -u admin:admin  "https://localhost/pulp/api/v2/events/" |json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   577  100   577    0     0   3085      0 --:--:-- --:--:-- --:--:--  3118
[
    {
        "notifier_config": {
            "addresses": [
                "preethit"
            ],
            "subject": "sync started"
        },
        "_ns": "event_listeners",
        "event_types": [
            "repo.sync.start"
        ],
        "_id": {
            "$oid": "50731d50edfc065dee00001a"
        },
        "id": "50731d50edfc065dee00001a",
        "notifier_type_id": "email",
        "_href": "/pulp/api/v2/events/"
    },
    {
        "notifier_config": {
            "addresses": [
                "preethit"
            ],
            "subject": "event"
        },
        "_ns": "event_listeners",
        "event_types": [
            "repo.publish.finish"
        ],
        "_id": {
            "$oid": "5075b98fedfc065dee000268"
        },
        "id": "5075b98fedfc065dee000268",
        "notifier_type_id": "email",
        "_href": "/pulp/api/v2/events/"
    }
]
[root@pulp-master ~]#

Comment 4 Michael Hrivnak 2013-02-05 21:24:32 UTC
I think there is confusion over how to verify this. The link to documentation in the original report could be misleading.

The example in comment #3 is a listing of event listeners, not a listing of actual events. To test this bug fix, you must cause an event to occur and then inspect the event. Here is a publish start event I just produced by running:

$ pulp-admin puppet repo publish run --repo-id=forge

And I listened with AMQP (after setting up an AMQP event listener), getting this output:

$ playpen/qpid/listen.py -e pulp
------------------
Message(subject=u'pulp.server.repo.publish.start', properties={u'qpid.subject': u'pulp.server.repo.publish.start', 'x-amqp-0-10.routing-key': u'pulp.server.repo.publish.start'}, content='{"call_report": {"task_group_id": null, "exception": null, "traceback": null, "task_id": "30f7ae83-ecfc-4b03-9fb3-0e5ff7f3fbad", "call_request_tags": ["pulp:repository:forge", "pulp:action:publish"], "reasons": [], "start_time": "2013-02-05T21:19:41Z", "tags": ["pulp:repository:forge", "pulp:action:publish"], "state": "running", "finish_time": null, "dependency_failures": {}, "schedule_id": null, "progress": {}, "call_request_group_id": null, "call_request_id": "30f7ae83-ecfc-4b03-9fb3-0e5ff7f3fbad", "principal_login": "admin", "response": "accepted", "result": null}, "event_type": "repo.publish.start", "payload": {"repo_id": "forge", "distributor_id": "puppet_distributor"}}')

It's a lot to wade through, but I promise, there is a task ID about 30% of the way through it.

Comment 5 Preethi Thomas 2013-04-01 14:12:56 UTC
verified

[root@mgmt8 ~]# python listen.py
------------------
Message(subject=u'pulp.server.repo.sync.start', properties={u'qpid.subject': u'pulp.server.repo.sync.start', 'x-amqp-0-10.routing-key': u'pulp.server.repo.sync.start'}, content='{"call_report": {"task_group_id": "32d508f5-f1b7-4422-ba8f-5c0e763618a1", "exception": null, "traceback": null, "task_id": "dea4db1c-5ed7-4c8d-b95e-d9956da32015", "call_request_tags": ["pulp:repository:forge", "pulp:action:sync"], "reasons": [], "start_time": "2013-04-01T13:12:16Z", "tags": ["pulp:repository:forge", "pulp:action:sync"], "state": "running", "finish_time": null, "dependency_failures": {}, "schedule_id": null, "progress": {}, "call_request_group_id": "32d508f5-f1b7-4422-ba8f-5c0e763618a1", "call_request_id": "dea4db1c-5ed7-4c8d-b95e-d9956da32015", "principal_login": "admin", "response": "accepted", "result": null}, "event_type": "repo.sync.start", "payload": {"repo_id": "forge"}}')

Comment 6 Preethi Thomas 2013-04-08 16:02:04 UTC
Pulp 2.1 released 


http://www.pulpproject.org/2013/04/05/pulp-2-1-0-released/