1 |
commit: 6cf9a8559b9c696cb067ec05f7ed5ecda0455d06 |
2 |
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 29 14:43:13 2012 +0000 |
4 |
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 29 14:43:13 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=6cf9a855 |
7 |
|
8 |
adding updatedb to job host deamon part2 |
9 |
|
10 |
--- |
11 |
gobs/bin/gobs_host_jobs~ | 55 ---------------------------------------------- |
12 |
1 files changed, 0 insertions(+), 55 deletions(-) |
13 |
|
14 |
diff --git a/gobs/bin/gobs_host_jobs~ b/gobs/bin/gobs_host_jobs~ |
15 |
deleted file mode 100755 |
16 |
index 87e856e..0000000 |
17 |
--- a/gobs/bin/gobs_host_jobs~ |
18 |
+++ /dev/null |
19 |
@@ -1,55 +0,0 @@ |
20 |
-#!/usr/bin/python |
21 |
-# Copyright 2006-2011 Gentoo Foundation |
22 |
-# Distributed under the terms of the GNU General Public License v2 |
23 |
- |
24 |
-from __future__ import print_function |
25 |
- |
26 |
-from gobs.init_setup_profile import setup_profile_main |
27 |
-from gobs.readconf import get_conf_settings |
28 |
-from gobs.updatedb import update_db_main |
29 |
- |
30 |
-reader = get_conf_settings() |
31 |
-gobs_settings_dict=reader.read_gobs_settings_all() |
32 |
- |
33 |
-# make a CM |
34 |
-from gobs.ConnectionManager import connectionManager |
35 |
-CM=connectionManager(gobs_settings_dict) |
36 |
-#selectively import the pgsql/mysql querys |
37 |
-if CM.getName()=='pgsql': |
38 |
- from gobs.pgsql import * |
39 |
-import logging |
40 |
- |
41 |
-def main(): |
42 |
- # Main |
43 |
- config_profile = gobs_settings_dict['gobs_config'] |
44 |
- # Logging |
45 |
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \ |
46 |
- format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO) |
47 |
- repeat = True |
48 |
- logging.info("Job deamon started.") |
49 |
- while repeat: |
50 |
- conn = CM.getConnection() |
51 |
- job = check_job_list(conn, config_profile) |
52 |
- |
53 |
- if job is None: |
54 |
- time.sleep(60) |
55 |
- CM.putConnection(conn) |
56 |
- continue |
57 |
- else: |
58 |
- logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_profile) |
59 |
- if job[0] == "updatedb": |
60 |
- update_job_list(conn, "Runing", job[1]) |
61 |
- logging.info("Job %s is runing. Config: %s", job[0], config_profile) |
62 |
- result = update_db_main() |
63 |
- if result is True |
64 |
- update_job_list(conn, "Done", job[1]) |
65 |
- logging.info("Job %s is done. Config: %s", job[0], config_profile) |
66 |
- else: |
67 |
- update_job_list(conn, "Fail", job[1]) |
68 |
- logging.info("Job %s did fail. Config: %s", job[0], config_profile) |
69 |
- repeat = False |
70 |
- CM.putConnection(conn) |
71 |
- time.sleep(60) |
72 |
- |
73 |
-if __name__ == "__main__": |
74 |
- main() |
75 |
\ No newline at end of file |