This commit is contained in:
yash 2019-07-30 11:22:32 -04:00
Родитель 86fb0e50c5
Коммит 8eaf490991
3 изменённых файлов: 39 добавлений и 5 удалений

Просмотреть файл

@ -112,6 +112,18 @@
{
"cell_type": "code",
"source": [
"# todo: use from akn\n",
"def to_datetime(timestamp):\n",
" s = timestamp[:23] + 'Z' # only allow 5 decimals of precision\n",
" for f in (\"%Y-%m-%d %H:%M:%S.%fZ\", \"%Y-%m-%dT%H:%M:%S.%fZ\"):\n",
" try:\n",
" return datetime.strptime(s, f)\n",
" except:\n",
" pass\n",
"def get_time(timestamp, d):\n",
" return int((cal.timegm(to_datetime(timestamp).timetuple()) + (d * 60)) * 1000)\n",
"# end todo\n",
"\n",
"def getKustoQuery(csl_filename, params):\n",
" return tokenize(os.path.join(queryPath, csl_filename), params)\n",
" \n",
@ -315,7 +327,7 @@
"print('Report!')\n",
"print('=' * 50, '\\n\\n')\n",
"\n",
"jarvisParams = {'su': su, 'start': akn.get_time(start, -10), 'end': akn.get_time(end, 10), 'service': service }\n",
"jarvisParams = {'su': su, 'start': get_time(start, -10), 'end': get_time(end, 10), 'service': service }\n",
"\n",
"# jarvis\n",
"jarvisLink = \"\"\"https://jarvis-west.dc.ad.msft.net/dashboard/VSO-ServiceInsights/DevOpsReports/TFS DevOpsReports\"\"\" \\\n",
@ -414,7 +426,7 @@
"print('Vip Swap? =============================')\n",
"if len(vipSwapResultDf.index) > 0:\n",
" viptime = vipSwapResultDf[\"TIMESTAMP\"][0]\n",
" starttime = akn.to_datetime(start)\n",
" starttime = to_datetime(start)\n",
" delta = starttime.replace(tzinfo=None) - viptime.replace(tzinfo=None)\n",
" if delta.total_seconds() > 0:\n",
" print(\"\"\"VIP SWAP happened: %s days %s hours %s minutes ago (%s) (issue start: %s)\"\"\" % (delta.days, delta.seconds//3600, (delta.seconds//60) % 60, viptime, start))\n",

Просмотреть файл

@ -110,7 +110,18 @@
{
"cell_type": "code",
"source": [
"\n",
"# todo: use from akn\n",
"def to_datetime(timestamp):\n",
" s = timestamp[:23] + 'Z' # only allow 5 decimals of precision\n",
" for f in (\"%Y-%m-%d %H:%M:%S.%fZ\", \"%Y-%m-%dT%H:%M:%S.%fZ\"):\n",
" try:\n",
" return datetime.strptime(s, f)\n",
" except:\n",
" pass\n",
"def get_time(timestamp, d):\n",
" return int((cal.timegm(to_datetime(timestamp).timetuple()) + (d * 60)) * 1000)\n",
"# end todo\n",
" \n",
"def getKustoQuery(csl_filename, params):\n",
" return tokenize(os.path.join(queryPath, csl_filename), params)\n",
" \n",
@ -227,7 +238,7 @@
"print('Report!')\n",
"print('=' * 50, '\\n\\n')\n",
"\n",
"jarvisParams = {'su': su, 'start': akn.get_time(start, -10), 'end': akn.get_time(end, 10), 'service': service }\n",
"jarvisParams = {'su': su, 'start': get_time(start, -10), 'end': get_time(end, 10), 'service': service }\n",
"\n",
"# jarvis\n",
"jarvisLink = \"\"\"https://jarvis-west.dc.ad.msft.net/dashboard/VSO-ServiceInsights/DevOpsReports/TFS DevOpsReports\"\"\" \\\n",
@ -243,7 +254,7 @@
"print('Vip Swap? =============================')\n",
"if len(vipSwapResultDf.index) > 0:\n",
" viptime = vipSwapResultDf[\"TIMESTAMP\"][0]\n",
" starttime = akn.to_datetime(start)\n",
" starttime = to_datetime(start)\n",
" delta = starttime.replace(tzinfo=None) - viptime.replace(tzinfo=None)\n",
" if delta.total_seconds() > 0:\n",
" print(\"\"\"VIP SWAP happened: %s days %s hours %s minutes ago (%s) (issue start: %s)\"\"\" % (delta.days, delta.seconds//3600, (delta.seconds//60) % 60, viptime, start))\n",

Просмотреть файл

@ -110,6 +110,17 @@
{
"cell_type": "code",
"source": [
"# todo: use from akn\n",
"def to_datetime(timestamp):\n",
" s = timestamp[:23] + 'Z' # only allow 5 decimals of precision\n",
" for f in (\"%Y-%m-%d %H:%M:%S.%fZ\", \"%Y-%m-%dT%H:%M:%S.%fZ\"):\n",
" try:\n",
" return datetime.strptime(s, f)\n",
" except:\n",
" pass\n",
"def get_time(timestamp, d):\n",
" return int((cal.timegm(to_datetime(timestamp).timetuple()) + (d * 60)) * 1000)\n",
"# end todo\n",
"\n",
"def getKustoQuery(csl_filename, params):\n",
"\n",