Add dtr db writer
authorTaejin Woo <tt.woo@samsung.com>
Thu, 28 Jun 2018 10:25:44 +0000 (19:25 +0900)
committerYonghee Han <onstudy@samsung.com>
Thu, 31 Jan 2019 01:21:23 +0000 (10:21 +0900)
Change-Id: I6b1d9b4f48fa94bdbb3386871db08909308d2e9e
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
dtr/job_dtr_db_write.py [new file with mode: 0644]
dtr/job_dtr_status.py
packaging/jenkins-scripts.spec

diff --git a/dtr/job_dtr_db_write.py b/dtr/job_dtr_db_write.py
new file mode 100644 (file)
index 0000000..e9df385
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+#
+# Copyright (C) 2017 Samsung Electronics. Co,. Ltd.
+#
+#    This program is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU General Public License
+#    as published by the Free Software Foundation; version 2
+#    of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+
+import sys
+import os
+import json
+import pprint
+
+from common.buildmonitor_db import do_query, get_value_from_query_data, do_many_query, connect_db, disconnect_db
+from common.buildmonitor_extention import BuildMonitorExtention
+
+def DTR_ver_info_fun(TOTAL_INFO, key_test_date):
+    connect_db()
+
+    query = "INSERT INTO dtr_main_info (id, test_date, tizen_release_version) VALUES(%s, %s, %s)"
+    query_var_list = []
+
+    for ver in TOTAL_INFO['tizen_version']:
+        query_var_list.append( (None, key_test_date, TOTAL_INFO[ver]) )
+
+    do_many_query(query, query_var_list)
+    pprint.pprint(do_many_query)
+
+    disconnect_db()
+
+
+def main(TOTAL_INFO):
+    key_test_date = TOTAL_INFO['test_ver_info_data']['test_date']
+
+    ## 1. DTR ver. info data (complete)
+    DTR_ver_info_fun(TOTAL_INFO['test_ver_info_data'], key_test_date, DTR_DB)
+
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main())
index 20dfe56..e28db5d 100644 (file)
@@ -50,13 +50,12 @@ def dtr_ver_info_export(sheet, srbd_data):
     total_results = {}
     total_results['tizen_version'] = []
     total_results['url_list']      = []
-    total_results['test_date']     = []
 
     total_results['row']           = nrow
     total_results['col']           = ncol
 
     test_date = datetime.now()
-    total_results['test_date'].append(test_date.strftime('%Y-%m-%d'))
+    total_results['test_date'] = test_date.strftime('%Y-%m-%d')
 
 
     ver_list = []
index 9196c43..532ed1b 100644 (file)
@@ -386,5 +386,6 @@ fi
 %defattr(-,jenkins,jenkins)
 %dir %{destdir}/dtr
 %{destdir}/dtr/job_dtr_status.py
+%{destdir}/dtr/job_dtr_db_write.py
 
 %changelog