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, 23 Dec 2012 17:09:07 +0000 (UTC) [thread overview]
Message-ID: <1356282528.568ff94daf38bbdfbafb0b296f935a74424e6744.zorry@gentoo> (raw)
commit: 568ff94daf38bbdfbafb0b296f935a74424e6744
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 23 17:08:48 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Dec 23 17:08:48 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=568ff94d
We use the Event scheduler in the mysql for the cron stuff
---
gobs/bin/gobs_cron | 25 -------------------------
gobs/pym/cron.py | 13 -------------
gobs/pym/mysql_querys.py | 42 ------------------------------------------
3 files changed, 0 insertions(+), 80 deletions(-)
diff --git a/gobs/bin/gobs_cron b/gobs/bin/gobs_cron
deleted file mode 100755
index 773700b..0000000
--- a/gobs/bin/gobs_cron
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import print_function
-
-from gobs.readconf import get_conf_settings
-from gobs.cron import cron_main
-from gobs.ConnectionManager import connectionManager
-from gobs.mysql_querys import add_gobs_logs, get_config_id
-
-def main():
- # Main
- reader = get_conf_settings()
- gobs_settings_dict=reader.read_gobs_settings_all()
- config_profile = gobs_settings_dict['gobs_config']
- CM=connectionManager()
- conn = CM.newConnection()
- config_id = get_config_id(conn, config_profile)
- add_gobs_logs(conn, "Cron job started", "info", config_id)
- cron_main(conn, config_id)
- add_gobs_logs(conn, "Cron job done.", "info", config_id)
- conn.close
-
-if __name__ == "__main__":
- main()
\ No newline at end of file
diff --git a/gobs/pym/cron.py b/gobs/pym/cron.py
deleted file mode 100644
index 706719f..0000000
--- a/gobs/pym/cron.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from __future__ import print_function
-
-from gobs.mysql_querys import get_cron_jobs, get_cron_info, check_jobs, \
- add_new_job, add_gobs_logs
-
-def cron_main(conn, config_id):
- cron_id_list = get_cron_jobs(conn, config_id)
- for cron_id in cron_id_list:
- job_type_id, run_config_id = get_cron_info(conn, cron_id)
- if not check_jobs(conn, job_type_id, config_id, run_config_id):
- log_msg = "Job: %s added to job list on %s for %s" % (job_type_id, config_id, run_config_id,)
- add_gobs_logs(conn, log_msg, "info", config_id)
- add_new_job(conn, cron_id, job_type_id, config_id, run_config_id)
diff --git a/gobs/pym/mysql_querys.py b/gobs/pym/mysql_querys.py
index 66c21f0..f179d26 100644
--- a/gobs/pym/mysql_querys.py
+++ b/gobs/pym/mysql_querys.py
@@ -55,48 +55,6 @@ def update_job_list(connection, status, job_id):
connection.commit()
cursor.close()
-def get_cron_jobs(connection, config_id):
- cursor = connection.cursor()
- sqlQ = 'SELECT cron_id FROM cron WHERE config_id = %s AND TIMESTAMPDIFF(MINUTES, time_stamp, NOW()) >= time_when'
- cursor.execute(sqlQ, (config_id,))
- entries = cursor.fetchall()
- cursor.close()
- if entries is None:
- return None
- cron_id_list = []
- for cron_id in entries:
- cron_id_list.append(cron_id[0])
- return sorted(cron_id_list)
-
-def check_jobs(connection, job_type_id, config_id, run_config_id):
- cursor = connection.cursor()
- sqlQ = "SELECT job_id FROM jobs WHERE job_type_id = %s AND config_id = %s AND run_config_id = %s AND (status = 'Runing' OR status = 'Waiting')"
- cursor.execute(sqlQ)
- entries = cursor.fetchone()
- cursor.close()
- if entries is None:
- return False
- return True
-
-def get_cron_info(connection, cron_id):
- cursor = connection.cursor()
- sqlQ = 'SELECT job_type_id, run_config_id FROM cron WHERE cron_id = %s'
- cursor.execute(sqlQ)
- entries = cursor.fetchone()
- cursor.close()
- job_type_id = entries[0]
- run_config_id = entries[1]
- return job_type_id, run_config_id
-
-def add_new_job(connection, cron_id, job_type_id, config_id, run_config_id):
- cursor = connection.cursor()
- sqlQ1 = "INSERT INTO jobs (job_type_id, user, config_id, run_config_id) VALUES ( %s, 'cron', %s, %s)"
- sqlQ2 = 'UPDATE cron SET time_stamp = NOW() WHERE cron_id = %s'
- cursor.execute(sqlQ1, (job_type_id, config_id, run_config_id,))
- cursor.execute(sqlQ2(cron_id,))
- connection.commit()
- cursor.close()
-
# Queryes to handel the configs* tables
def get_config_list_all(connection):
cursor = connection.cursor()
next reply other threads:[~2012-12-23 17:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-23 17:09 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-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-29 13:13 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=1356282528.568ff94daf38bbdfbafb0b296f935a74424e6744.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