Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit a6329a1e98cdce7babb680cc33b47f0bbce7f9f3
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Wed Nov 26 16:07:28 2014 +0100
[backend] PEP8 name convention
>---------------------------------------------------------------
backend/backend/dispatcher.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/backend/backend/dispatcher.py b/backend/backend/dispatcher.py
index c267941..8beb8ab 100644
--- a/backend/backend/dispatcher.py
+++ b/backend/backend/dispatcher.py
@@ -429,7 +429,7 @@ class Worker(multiprocessing.Process):
return True
return False
- def __spawn_with_check(self, job):
+ def spawn_instance_with_check(self, job):
""" Wrapper around self.spawn_instance() with exception checking """
try:
ip = self.spawn_instance(job)
@@ -508,7 +508,7 @@ class Worker(multiprocessing.Process):
if self.create and not self.ip:
if not self.spawn_in_advance:
- ip = self.__spawn_with_check(job)
+ ip = self.spawn_instance_with_check(job)
# else we get ip from similar calling at the enf of this while-loop
else:
ip = self.ip
@@ -611,4 +611,4 @@ class Worker(multiprocessing.Process):
if self.create:
self.terminate_instance(ip)
if self.create and not self.ip and self.spawn_in_advance:
- ip = self.__spawn_with_check(job)
+ ip = self.spawn_instance_with_check(job)
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 8d4856e7bbb4b60d0f17ddb993cee2a62b40b84f
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Nov 5 13:52:41 2014 +0100
allow to spawn builder in advance
>---------------------------------------------------------------
backend/backend/dispatcher.py | 30 +++++++++++++++++++-----------
backend/backend/helpers.py | 3 +++
backend/copr-be.conf.example | 5 +++++
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/backend/backend/dispatcher.py b/backend/backend/dispatcher.py
index 3ddc781..1854175 100644
--- a/backend/backend/dispatcher.py
+++ b/backend/backend/dispatcher.py
@@ -144,6 +144,7 @@ class Worker(multiprocessing.Process):
self.callback = callback
self.create = create
self.lock = lock
+ self.spawn_in_advance = self.opts.spawn_in_advance
self.frontend_callback = FrontendCallback(opts, events)
if not self.callback:
self.logfile = os.path.join(
@@ -428,6 +429,19 @@ class Worker(multiprocessing.Process):
return True
return False
+ def __spawn_with_check(self, job):
+ """ Wrapper around self.spawn_instance() with exception checking """
+ try:
+ ip = self.spawn_instance(job)
+ if not ip:
+ raise CoprWorkerError(
+ "No IP found from creating instance")
+ except ansible.errors.AnsibleError as e:
+ self.callback.log("failure to setup instance: {0}".format(e))
+ raise
+ return ip
+
+
def run(self):
"""
Worker should startup and check if it can function
@@ -492,18 +506,10 @@ class Worker(multiprocessing.Process):
# this is our best place to sanity check the job before starting
# up any longer process
- # spin up our build instance
if self.create and not self.ip:
- try:
- ip = self.spawn_instance(job)
- if not ip:
- raise CoprWorkerError(
- "No IP found from creating instance")
-
- except ansible.errors.AnsibleError as e:
- self.callback.log(
- "failure to setup instance: {0}".format(e))
- raise
+ if not self.spawn_in_advance:
+ ip = self.__spawn_with_check(job)
+ # else we get ip from similar calling at the enf of this while-loop
else:
ip = self.ip
@@ -610,3 +616,5 @@ class Worker(multiprocessing.Process):
# clean up the instance
if self.create:
self.terminate_instance(ip)
+ if self.create and not self.ip and self.spawn_in_advance:
+ ip = self.__spawn_with_check(job)
diff --git a/backend/backend/helpers.py b/backend/backend/helpers.py
index 0992eb6..61eabb2 100644
--- a/backend/backend/helpers.py
+++ b/backend/backend/helpers.py
@@ -147,6 +147,9 @@ class BackendConfigReader(object):
opts.prune_days = _get_conf(cp, "backend", "prune_days", None, mode="int")
opts.prune_script = _get_conf(cp, "backend", "prune_script", None, mode="path")
+ opts.spawn_in_advance = _get_conf(
+ cp, "backend", "spawn_in_advance", False, mode="bool")
+
# thoughts for later
# ssh key for connecting to builders?
# cloud key stuff?
diff --git a/backend/copr-be.conf.example b/backend/copr-be.conf.example
index ff79e6d..69bcf7b 100644
--- a/backend/copr-be.conf.example
+++ b/backend/copr-be.conf.example
@@ -101,6 +101,11 @@ prune_days=14
# path to executable script to clean old build
prune_script=/usr/share/copr/copr_prune_old_builds.sh
+# Spawn builder in advance, before we get task?
+# It save time, but consume resources even when
+# nothing is in queue
+#spawn_in_advance=false
+
[builder]
# default is 1800
timeout=3600
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 8e5bc300d5aa4e6fa46e9695aba70f5e7b93322a
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Nov 6 15:35:15 2014 +0100
[pyhton-copr] fixed Exception enheritance
>---------------------------------------------------------------
python/copr/client/exceptions.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/python/copr/client/exceptions.py b/python/copr/client/exceptions.py
index 6936548..73f832c 100644
--- a/python/copr/client/exceptions.py
+++ b/python/copr/client/exceptions.py
@@ -25,21 +25,21 @@ class CoprConfigException(CoprException):
pass
-class CoprRequestException(Exception):
+class CoprRequestException(CoprException):
""" Exception thrown when the request is bad. For example,
the user provided wrong project name or build ID.
"""
pass
-class CoprBuildException(Exception):
+class CoprBuildException(CoprException):
""" Exception thrown when one or more builds fail and client is waiting
for the result.
"""
pass
-class CoprUnknownResponseException(Exception):
+class CoprUnknownResponseException(CoprException):
""" Exception thrown when the response is unknown to client.
It usually means that something is broken.
"""