Merge lp:~pwlars/core-selftest-agent/agent-config into lp:core-selftest-agent

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 9
Merged at revision: 5
Proposed branch: lp:~pwlars/core-selftest-agent/agent-config
Merge into: lp:core-selftest-agent
Diff against target: 126 lines (+95/-1)
4 files modified
called-by-tarmac.py (+6/-0)
core_selftest_agent/__init__.py (+45/-1)
core_selftest_agent/constants.py (+42/-0)
requirements.txt (+2/-0)
To merge this branch: bzr merge lp:~pwlars/core-selftest-agent/agent-config
Reviewer Review Type Date Requested Status
Para Siva (community) Approve
Paul Larson Needs Resubmitting
Francis Ginther Approve
Review via email: mp+259799@code.launchpad.net

Commit message

Add config bits

Description of the change

Add config bits

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

A have a couple of inline comments. I think we're now safe to remove the modified hostname methods.

review: Needs Fixing
Revision history for this message
Paul Larson (pwlars) wrote :

Actually, I don't know that I'll even need a retry queue so I took it out for now. It may be necessary to retry internally for a failed manifest download or something, but I don't think this service has a concept of an infrastructure failure outside of its control that would require requeueing. I also replaced the hostname bit with socket.gethostname()

review: Needs Resubmitting
Revision history for this message
Francis Ginther (fginther) wrote :

I'm happy with this. As mentioned over IRC, there really is no reason for the agent to retry messages. The input is a fan-out exchange so every consumer will already have a copy, no need to throw it back to see if another consumer can make use of it. I also doubt we'll need deadletter, but am happy to wait and see on this.

I'm curious as to why you kept ".replace('-machine', '')" on the hostname. I don't think this is hurting anything. But I'm not going to block on this either.

review: Approve
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (3.4 KiB)

The attempt to merge lp:~pwlars/core-selftest-agent/agent-config into lp:core-selftest-agent failed. Below is the output from the failed tests.

Using base prefix '/usr'
New python executable in /tmp/venv-core-selftest-agentwtd8oky_/bin/python3
Also creating executable in /tmp/venv-core-selftest-agentwtd8oky_/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking python-logstash==0.4.2 (from -r requirements.txt (line 1))
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/index.py", line 252, in find_requirement
    for page in self._get_pages(locations, req):
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/index.py", line 387, in _get_pages
    page = self._get_page(location, req)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/index.py", line 568, in _get_page
    session=self.session,
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/index.py", line 670, in get_page
    resp = session.get(url, headers={"Accept": "text/html"})
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 395, in get
    return self.request('GET', url, **kwargs)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/download.py", line 237, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 349, in request
    prep = self.prepare_request(req)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 287, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/_vendor/requests/models.py", line 287, in prepare
    self.prepare_url(url, params)
  File "/tmp/venv-core-selftest-agentwtd8oky_/lib/python3.4/site-packages/pip/_vendor/requests/models.py", line 338, in prepare_url
    "Perhaps you meant http://{0}?".format(url))
pip._vendor.requests.exceptions.MissingSchema: Invalid URL '/tmp/tmpgxqm1lttpip-cache-/cache': No schema supplied. Perhaps you meant http:///tmp/tmpgxqm1lttpip-cache-/cache?

Storing debug log for failure in /home/tarmac/.pip/pip.log
INFO: Executing: virtualenv -p python3 /tmp/venv-core-selftest-agentwtd8oky_
INFO: Executing: /tmp/venv-core-selftest-agentwtd8...

Read more...

Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Paul Larson (pwlars) :
review: Needs Resubmitting
Revision history for this message
Para Siva (psivaa) wrote :

I see core-service.conf and SOLUTION_NAME=core-image-testing as potentially confusing but could notice some other services in the same solution are using this.

review: Approve
Revision history for this message
Paul Larson (pwlars) wrote :

Yeah, that's just a placeholder for now. A lot of that is going to need to change.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'called-by-tarmac.py'
2--- called-by-tarmac.py 2015-05-20 22:06:09 +0000
3+++ called-by-tarmac.py 2015-05-22 16:26:21 +0000
4@@ -59,6 +59,12 @@
5 pip_cache = os.path.join(pip_dir, 'cache')
6 all_cmds = (
7 [
8+ 'bzr',
9+ 'branch',
10+ PIP_CACHE_BRANCH,
11+ pip_cache,
12+ ],
13+ [
14 'virtualenv',
15 '-p',
16 'python3',
17
18=== modified file 'core_selftest_agent/__init__.py'
19--- core_selftest_agent/__init__.py 2015-05-20 17:30:07 +0000
20+++ core_selftest_agent/__init__.py 2015-05-22 16:26:21 +0000
21@@ -15,6 +15,50 @@
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #
24
25+import argparse
26+import configparser
27+import logging
28+import os
29+
30+from uservice_utils.logging import (
31+ configure_service_logging,
32+ ExtraLogger,
33+)
34+
35+from core_selftest_agent import constants
36+
37+
38+def read_config():
39+ parser = argparse.ArgumentParser(description='Core Selftest Agent.')
40+ parser.add_argument(
41+ '-c',
42+ '--conf',
43+ default='core-service.conf',
44+ help='Configuration file path'
45+ )
46+ args = parser.parse_args()
47+
48+ # Load configuration options.
49+ config = configparser.ConfigParser()
50+ config.read(args.conf)
51+ return config
52+
53+
54+def get_logger(name, extra={}):
55+ if logging.getLoggerClass() != ExtraLogger:
56+ logging.setLoggerClass(ExtraLogger)
57+ logger = logging.getLogger(name)
58+ e = constants.LOGGING_EXTRA.copy()
59+ e.update(extra)
60+ logger.set_extra_args(e)
61+ return logger
62+
63
64 def main():
65- pass
66+ config = read_config()
67+ log_path = os.path.abspath(
68+ os.path.join(__file__, '../../logs/core-selftest-agent.log'))
69+ configure_service_logging(
70+ log_path,
71+ config['logstash'] if 'logstash' in config else None
72+ )
73
74=== added file 'core_selftest_agent/constants.py'
75--- core_selftest_agent/constants.py 1970-01-01 00:00:00 +0000
76+++ core_selftest_agent/constants.py 2015-05-22 16:26:21 +0000
77@@ -0,0 +1,42 @@
78+# core-selftest-agent
79+# Copyright (C) 2015 Canonical
80+#
81+# This program is free software: you can redistribute it and/or modify
82+# it under the terms of the GNU General Public License as published by
83+# the Free Software Foundation, either version 3 of the License, or
84+# (at your option) any later version.
85+#
86+# This program is distributed in the hope that it will be useful,
87+# but WITHOUT ANY WARRANTY; without even the implied warranty of
88+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89+# GNU General Public License for more details.
90+#
91+# You should have received a copy of the GNU General Public License
92+# along with this program. If not, see <http://www.gnu.org/licenses/>.
93+#
94+
95+"""Constants for this service."""
96+import socket
97+
98+# Queue names are constant, rather than being defined in the config.
99+
100+# The queue we listen to for new payloads to check:
101+INPUT_QUEUE = "pm.candidates"
102+
103+# The queue we send events on to request image build and test
104+OUTPUT_QUEUE = "core.package.v1"
105+
106+# The queue we put fatally error'd payloads into:
107+DEAD_LETTER_QUEUE = "core.deadletters.v1"
108+
109+SOLUTION_NAME = "core-image-testing"
110+
111+SERVICE_NAME = "core-selftest-agent"
112+
113+HOSTNAME = socket.gethostname().replace('-machine', '')
114+
115+LOGGING_EXTRA = {
116+ 'solution': SOLUTION_NAME,
117+ 'service': SERVICE_NAME,
118+ 'hostname': HOSTNAME,
119+}
120
121=== modified file 'requirements.txt'
122--- requirements.txt 2015-05-20 17:10:57 +0000
123+++ requirements.txt 2015-05-22 16:26:21 +0000
124@@ -0,0 +1,2 @@
125+python-logstash==0.4.2
126+uservice-utils==1.0.2.1

Subscribers

People subscribed via source and target branches