Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 4b2d10523c7460a9bdeb7fe9e3c92fc1d7559bff
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Fri Jul 18 11:49:13 2014 +0200
[frontend] new build status: Starting
---------------------------------------------------------------
frontend/coprs_frontend/coprs/helpers.py | 3 ++-
frontend/coprs_frontend/coprs/models.py | 18 ++++++++++++------
frontend/coprs_frontend/coprs/static/copr.css | 4 ++++
.../coprs/views/backend_ns/backend_general.py | 12 ++++++++++++
4 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/helpers.py
b/frontend/coprs_frontend/coprs/helpers.py
index bb26265..b1e62b9 100644
--- a/frontend/coprs_frontend/coprs/helpers.py
+++ b/frontend/coprs_frontend/coprs/helpers.py
@@ -63,7 +63,8 @@ class StatusEnum(object):
"canceled": 2,
"running": 3,
"pending": 4,
- "skipped": 5} # if there was this package built already
+ "skipped": 5, # if there was this package built already
+ "starting": 6} # build picked by worker but no VM initialized
class Paginator(object):
diff --git a/frontend/coprs_frontend/coprs/models.py
b/frontend/coprs_frontend/coprs/models.py
index ffb7009..d9538a3 100644
--- a/frontend/coprs_frontend/coprs/models.py
+++ b/frontend/coprs_frontend/coprs/models.py
@@ -267,11 +267,16 @@ class Build(db.Model, helpers.Serializer):
@property
def has_pending_chroot(self):
- return helpers.StatusEnum("pending") in self.chroot_states
+ # FIXME bad name
+ # used when checking if the repo is initialized and results can be set
+ # i think this is the only purpose - check
+ return helpers.StatusEnum("pending") in self.chroot_states or \
+ helpers.StatusEnum("starting") in self.chroot_states
@property
def has_unfinished_chroot(self):
return helpers.StatusEnum("pending") in self.chroot_states or \
+ helpers.StatusEnum("starting") in self.chroot_states or \
helpers.StatusEnum("running") in self.chroot_states
@property
@@ -283,7 +288,7 @@ class Build(db.Model, helpers.Serializer):
if self.canceled:
return helpers.StatusEnum("canceled")
- for state in ["failed", "running", "pending",
"succeeded", "skipped"]:
+ for state in ["failed", "running", "starting",
"pending", "succeeded", "skipped"]:
if helpers.StatusEnum(state) in self.chroot_states:
return helpers.StatusEnum(state)
@@ -303,7 +308,7 @@ class Build(db.Model, helpers.Serializer):
"""
Find out if this build is cancelable.
- ATM, build is cancelable only if it wasn"t grabbed by backend.
+ Build is cancelabel only when it's pending (not started)
"""
return self.status == helpers.StatusEnum("pending")
@@ -313,11 +318,12 @@ class Build(db.Model, helpers.Serializer):
"""
Find out if this build is repeatable.
- Build is repeatable only if it's not pending
- (because it would just duplicate the same thing in db)
+ Build is repeatable only if it's not pending, starting or running
"""
- return self.status != helpers.StatusEnum("pending")
+ return self.status != helpers.StatusEnum("pending") and \
+ self.status != helpers.StatusEnum("starting") and \
+ self.status != helpers.StatusEnum("running")
@property
def deletable(self):
diff --git a/frontend/coprs_frontend/coprs/static/copr.css
b/frontend/coprs_frontend/coprs/static/copr.css
index 87048df..e140730 100644
--- a/frontend/coprs_frontend/coprs/static/copr.css
+++ b/frontend/coprs_frontend/coprs/static/copr.css
@@ -346,6 +346,10 @@ tr.build-row-skipped {
color: #55b;
}
+.build-starting {
+ color: #c84;
+}
+
.build-running {
color: #c84;
}
diff --git a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
index 1a9f473..cb5839b 100644
--- a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
+++ b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
@@ -88,3 +88,15 @@ def update():
"non_existing_{0}_ids".format(typ): non_existing_ids})
return flask.jsonify(result)
+
+
+(a)backend_ns.route("/starting_build/<build_id>/",
methods=["POST", "PUT"])
+(a)misc.backend_authenticated
+def start_build(build_id):
+ """
+ Check if the build is not cancelled and set it to running state
+ """
+ pass
+
+
+