import os
import sys
-import datetime
import json
import base64
import re
+from datetime import datetime
from time import sleep
from common import buildmonitor_db
from common.buildtrigger import trigger_info, trigger_next, remote_jenkins_build_job
#print '[%s] curr_sr_status_id(%s)\n' % (__file__, curr_sr_status_id)
if curr_sr_status_id == INVALID_ID:
- query = "INSERT INTO sr_status (sr, status) VALUES(%s, %s)"
- query_data = (bm_git_tag, 'C')
+ query = "INSERT INTO sr_status (sr, status, submit_time) VALUES(%s, %s, %s)"
+ query_data = (bm_git_tag, 'C', datetime.strptime(bm_git_tag[-15:], '%Y%m%d.%H%M%S'))
buildmonitor_db.do_query(query, query_data)
else:
print '[%s] Already existing sr_status_id(%s) skip INSERT sr_stage\n' \
query_list = []
for each_pkg_name, each_pkg_mdate, each_pkg_size in zip(bm_pkg_name_lst, bm_pkg_mdate_lst, bm_pkg_size_lst):
- timestamp = datetime.datetime.fromtimestamp(each_pkg_mdate)
+ timestamp = datetime.fromtimestamp(each_pkg_mdate)
#print '[%s] each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)' \
# % (__file__, each_pkg_name, timestamp, each_pkg_size)
query_list.append((curr_build_snapshot_id, bm_repo, bm_arch,
#print '[%s] bm_prj_name(%s), bm_split_data(%s), bm_git_tag(%s), bm_url(%s)\n' \
# % (__file__, bm_prj_name, bm_split_data, bm_git_tag, bm_url)
- bm_end_datetime = datetime.datetime.now()
+ bm_end_datetime = datetime.now()
bm_repo = fields["repo"]
bm_device_name = fields["name"]
def end_create_image_for_sr_stage(bm_start_datetime, project, bm_snapshot_name):
print '[%s] enter end_create_image_for_sr_stage project(%s)\n' % (__file__, project)
- bm_end_datetime = datetime.datetime.now()
+ bm_end_datetime = datetime.now()
if project.startswith("home:prerelease:") or project.startswith("home:trbs:"):
bm_git_tag = project.split(":")[-3] + '/' + project.split(":")[-2] + '/' + project.split(":")[-1]
for each_sr_status_id in multi_sr_status_id:
print '[%s] each_sr_status_id(%s)\n' % (__file__, each_sr_status_id)
info_stage_id = POST_BUILD
- bm_end_datetime = datetime.datetime.now()
+ bm_end_datetime = datetime.now()
query = "UPDATE sr_stage SET stage_end_time = %s, stage_status = %s " \
"WHERE sr_status_id = %s AND info_stage_id = %s AND build_project_id = %s"
query_data = (bm_end_datetime, 'S',
query_list = []
for each_pkg_name, each_pkg_mdate, each_pkg_size in zip(bm_pkg_name_lst, bm_pkg_mdate_lst, bm_pkg_size_lst):
- timestamp = datetime.datetime.fromtimestamp(each_pkg_mdate)
+ timestamp = datetime.fromtimestamp(each_pkg_mdate)
# post build
#print '[%s] curr_build_snapshot_id(%s), each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)\n' \
# % (__file__, curr_build_snapshot_id, each_pkg_name, timestamp, each_pkg_size)
query_list = []
for each_pkg_name, each_pkg_mdate, each_pkg_size in zip(bm_pkg_name_lst, bm_pkg_mdate_lst, bm_pkg_size_lst):
- timestamp = datetime.datetime.fromtimestamp(each_pkg_mdate)
+ timestamp = datetime.fromtimestamp(each_pkg_mdate)
#print '[%s] each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)' \
# % (__file__, each_pkg_name, timestamp, each_pkg_size)
query_list.append((curr_build_snapshot_id, bm_repo, bm_arch,
#print '[%s] bm_prj_name(%s), bm_split_data(%s), bm_git_tag(%s), bm_url(%s)\n' \
# % (__file__, bm_prj_name, bm_split_data, bm_git_tag, bm_url)
- bm_end_datetime = datetime.datetime.now()
+ bm_end_datetime = datetime.now()
bm_repo = fields["repo"]
bm_device_name = fields["name"]
print '[%s] enter TRBS_end_create_image_for_sr_stage project(%s)\n' % (__file__, project)
if project.startswith("home:prerelease:") or project.startswith("home:trbs:"):
- bm_end_datetime = datetime.datetime.now()
+ bm_end_datetime = datetime.now()
bm_git_tag = project.split(":")[-3] + '/' + project.split(":")[-2] + '/' + project.split(":")[-1]
#print '[%s] bm_git_tag(%s)\n' % (__file__, bm_git_tag)