From: "Magnus Granberg" <zorry@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/zorry:master commit in: gobs/bin/, gobs/pym/
Date: Sun, 29 Apr 2012 13:13:06 +0000 (UTC) [thread overview]
Message-ID: <1335704995.9d85fe87e992047e0972eceb82c0a81e819ed6f7.zorry@gentoo> (raw)
commit: 9d85fe87e992047e0972eceb82c0a81e819ed6f7
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 29 13:09:55 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Apr 29 13:09:55 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=9d85fe87
start of the job host deamon
---
gobs/bin/gobs_host_jobs | 45 +++++++++++++++++++++++++++++++++++++++++++++
gobs/pym/pgsql.py | 18 ++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
new file mode 100755
index 0000000..856041c
--- /dev/null
+++ b/gobs/bin/gobs_host_jobs
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# Copyright 2006-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from __future__ import print_function
+
+from gobs.init_setup_profile import setup_profile_main
+from gobs.readconf import get_conf_settings
+reader = get_conf_settings()
+gobs_settings_dict=reader.read_gobs_settings_all()
+
+# make a CM
+from gobs.ConnectionManager import connectionManager
+CM=connectionManager(gobs_settings_dict)
+#selectively import the pgsql/mysql querys
+if CM.getName()=='pgsql':
+ from gobs.pgsql import *
+# import logging
+
+def main():
+ # Main
+ config_profile = gobs_settings_dict['gobs_config']
+ # Logging
+ #logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \
+ # format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO)
+ conn = CM.getConnection()
+ CM.putConnection(conn)
+ repeat = True
+ while repeat:
+ conn = CM.getConnection()
+ job jobid = check_job_list(conn, config_profile)
+ print("job jobid:" + job + " " + jobid)
+ if job is None:
+ time.sleep(60)
+ CM.putConnection(conn)
+ continue
+ else:
+ update_job_list("Runing", jobid)
+ repeat = False
+ CM.putConnection(conn)
+ time.sleep(60)
+ connectionManager.closeAllConnections()
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/gobs/pym/pgsql.py b/gobs/pym/pgsql.py
index db70f6c..21c204d 100644
--- a/gobs/pym/pgsql.py
+++ b/gobs/pym/pgsql.py
@@ -636,3 +636,21 @@ def add_fail_querue_dict(connection, fail_querue_dict):
def make_conf_error(connection,config_profile):
pass
+
+def check_job_list(connection, config_profile):
+ cursor = connection.cursor()
+ sqlQ1 = 'SELECT idnr FROM config WHERE id = %s'
+ sqlQ2 = "SELECT job, jobnr FROM jobs_list WHERE status = 'Waiting' AND config_id = %s"
+ cursor.execute(sqlQ1, (config_profile,))
+ config_nr = cursor.fetchone()
+ cursor.execute(sqlQ2, (config_nr,))
+ job jobid = cursor.fetchone()
+ if job is None:
+ return None None
+ return job jobid
+
+def update_job_list(status, jobid)
+ cursor = connection.cursor()
+ sqlQ = 'UPDATE jobs_list SET ststus = %s WHERE jobid = %s'
+ cursor.execute(sqlQ, (status, jobid,))
+ connection.commit()
next reply other threads:[~2012-04-29 13:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-29 13:13 Magnus Granberg [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-12-27 23:09 [gentoo-commits] dev/zorry:master commit in: gobs/bin/, gobs/pym/ Magnus Granberg
2012-12-23 17:09 Magnus Granberg
2012-12-22 2:59 Magnus Granberg
2012-12-21 1:44 Magnus Granberg
2012-12-19 2:11 Magnus Granberg
2012-12-07 14:07 Magnus Granberg
2012-12-05 23:56 Magnus Granberg
2012-11-29 22:22 Magnus Granberg
2012-07-17 0:07 Magnus Granberg
2012-06-26 22:10 Magnus Granberg
2012-05-13 17:59 Magnus Granberg
2012-05-09 23:12 Magnus Granberg
2012-05-06 10:41 Magnus Granberg
2012-05-04 22:32 Magnus Granberg
2012-05-01 1:12 Magnus Granberg
2012-04-30 12:08 Magnus Granberg
2012-04-29 14:43 Magnus Granberg
2012-04-29 13:16 Magnus Granberg
2012-04-28 16:01 Magnus Granberg
2012-04-27 22:22 Magnus Granberg
2012-04-27 20:59 Magnus Granberg
2011-11-01 21:14 Magnus Granberg
2011-10-29 0:14 Magnus Granberg
2011-09-28 10:53 Magnus Granberg
2011-09-28 0:33 Magnus Granberg
2011-09-26 23:25 Magnus Granberg
2011-08-31 1:46 Magnus Granberg
2011-08-30 23:02 Magnus Granberg
2011-07-31 13:43 Magnus Granberg
2011-04-24 22:13 Magnus Granberg
2011-04-23 14:23 Magnus Granberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1335704995.9d85fe87e992047e0972eceb82c0a81e819ed6f7.zorry@gentoo \
--to=zorry@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox