Skip to content
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

Add sync/task endpoint to list all sync tasks #488

Closed
wants to merge 2 commits into from

Conversation

rochacbruno
Copy link
Member

  • Added /sync/tasks/ endpoint
  • Serializer includes Worker, Child and Parent tasks info
  • Using same accesspolicy of CollectionRemote

Issue: #459

Endpoint results
galaxy_ng on  sync_tasks [$] via  v3.8.5 (galaxy_ng) took 4s
❯ galaxy /api/automation-hub/content/rh-certified/v3/sync/tasks/
HTTP/1.1 200 OK
X-Powered-By: Express
allow: GET, HEAD, OPTIONS
connection: close
content-length: 3111
content-type: application/json
date: Thu, 24 Sep 2020 19:04:21 GMT
server: gunicorn/20.0.4
vary: Accept, Cookie
x-frame-options: SAMEORIGIN

{
    "data": [
        {
            "repository": "rh-certified",
            "task": {
                "child_tasks": [],
                "created_at": "2020-09-23T19:48:40.918537Z",
                "error": {
                    "description": "401, message='Unauthorized', url=URL('https://cloud.redhat.com/api/automation-hub/v3/collections?offset=0&limit=100')",
                    "traceback": "  File \"/venv/lib64/python3.6/site-packages/rq/worker.py\", line 934, in perform_job\n    rv = job.perform()\n  File \"/venv/lib64/python3.6/site-packages/rq/job.py\", line 686, in perform\n    self._result = self._execute()\n  File \"/venv/lib64/python3.6/site-packages/rq/job.py\", line 692, in _execute\n    return self.func(*self.args, **self.kwargs)\n  File \"/venv/lib64/python3.6/site-packages/pulp_ansible/app/tasks/collections.py\", line 81, in sync\n    d_version.create()\n  File \"/venv/lib64/python3.6/site-packages/pulpcore/plugin/stages/declarative_version.py\", line 148, in create\n    loop.run_until_complete(pipeline)\n  File \"/usr/lib64/python3.6/asyncio/base_events.py\", line 484, in run_until_complete\n    return future.result()\n  File \"/venv/lib64/python3.6/site-packages/pulpcore/plugin/stages/api.py\", line 225, in create_pipeline\n    await asyncio.gather(*futures)\n  File \"/venv/lib64/python3.6/site-packages/pulpcore/plugin/stages/api.py\", line 43, in __call__\n    await self.run()\n  File \"/venv/lib64/python3.6/site-packages/pulp_ansible/app/tasks/collections.py\", line 288, in run\n    async for metadata in self._fetch_collections():\n  File \"/venv/lib64/python3.6/site-packages/pulp_ansible/app/tasks/collections.py\", line 354, in _fetch_collections\n    initial_data = parse_metadata(await downloader.run())\n  File \"/venv/lib64/python3.6/site-packages/pulpcore/download/base.py\", line 227, in run\n    return await self._run(extra_data=extra_data)\n  File \"/venv/lib64/python3.6/site-packages/backoff/_async.py\", line 133, in retry\n    ret = await target(*args, **kwargs)\n  File \"/venv/lib64/python3.6/site-packages/pulp_ansible/app/downloaders.py\", line 88, in _run\n    return await super()._run(extra_data=extra_data)\n  File \"/venv/lib64/python3.6/site-packages/backoff/_async.py\", line 133, in retry\n    ret = await target(*args, **kwargs)\n  File \"/venv/lib64/python3.6/site-packages/pulpcore/download/http.py\", line 210, in _run\n    self.raise_for_status(response)\n  File \"/venv/lib64/python3.6/site-packages/pulp_ansible/app/downloaders.py\", line 66, in raise_for_status\n    response.raise_for_status()\n  File \"/venv/lib64/python3.6/site-packages/aiohttp/client_reqrep.py\", line 946, in raise_for_status\n    headers=self.headers)\n"
                },
                "finished_at": "2020-09-23T19:48:42.133145Z",
                "parent_task": null,
                "pk": "01c28d6e-ff23-435b-9f90-263c378ca62f",
                "started_at": "2020-09-23T19:48:41.088785Z",
                "state": "failed",
                "updated_at": "2020-09-23T19:48:42.134071Z",
                "worker": {
                    "last_heartbeat": "2020-09-24T19:04:09.825210Z",
                    "missing": false,
                    "name": "1@a2e32df5e8b2"
                }
            }
        }
    ],
    "links": {
        "first": "/api/automation-hub/content/rh-certified/v3/sync/tasks/?limit=10&offset=0",
        "last": "/api/automation-hub/content/rh-certified/v3/sync/tasks/?limit=10&offset=0",
        "next": null,
        "previous": null
    },
    "meta": {
        "count": 1
    }
}

- Added /sync/task/ endpoint
- Serializer includes Worker, Child and Parent tasks info
- Using same accesspolicy of CollectionRemote

Issue: #459
@rochacbruno
Copy link
Member Author

Replaced by #526

@rochacbruno rochacbruno deleted the sync_tasks branch October 22, 2020 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: Add endpoint for Synchronization Tasks History
1 participant