This is an automated email from the ASF dual-hosted git repository. marcoabreu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-ci.git
The following commit(s) were added to refs/heads/master by this push: new 3499cce Add jenkins success statistics (#2) 3499cce is described below commit 3499cceabca61c291df8fc1c668d25dfa28a46cd Author: Marco de Abreu <marcoab...@users.noreply.github.com> AuthorDate: Thu Aug 15 23:09:41 2019 +0200 Add jenkins success statistics (#2) --- .gitignore | 1 + tools/jenkins-success-statistics/README.md | 20 +++++++++++ tools/jenkins-success-statistics/report.py | 58 ++++++++++++++++++++++++++++++ tools/jenkins-success-statistics/run.sh | 20 +++++++++++ 4 files changed, 99 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad27e3a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.DS_STORE diff --git a/tools/jenkins-success-statistics/README.md b/tools/jenkins-success-statistics/README.md new file mode 100644 index 0000000..df8d9a8 --- /dev/null +++ b/tools/jenkins-success-statistics/README.md @@ -0,0 +1,20 @@ +<!--- Licensed to the Apache Software Foundation (ASF) under one --> +<!--- or more contributor license agreements. See the NOTICE file --> +<!--- distributed with this work for additional information --> +<!--- regarding copyright ownership. The ASF licenses this file --> +<!--- to you under the Apache License, Version 2.0 (the --> +<!--- "License"); you may not use this file except in compliance --> +<!--- with the License. You may obtain a copy of the License at --> + +<!--- http://www.apache.org/licenses/LICENSE-2.0 --> + +<!--- Unless required by applicable law or agreed to in writing, --> +<!--- software distributed under the License is distributed on an --> +<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --> +<!--- KIND, either express or implied. See the License for the --> +<!--- specific language governing permissions and limitations --> +<!--- under the License. --> + +# This calculates the CI success and failure rate for last week + +First run ./run.sh then ./report.py diff --git a/tools/jenkins-success-statistics/report.py b/tools/jenkins-success-statistics/report.py new file mode 100755 index 0000000..607efe7 --- /dev/null +++ b/tools/jenkins-success-statistics/report.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# -*- coding: utf-8 -*-3 +"""Description""" + +__author__ = 'Pedro Larroy' +__version__ = '0.1' + +import os +import sys +import json +import dateutil.parser +import datetime + + +def usage(): + sys.stderr.write('usage: {0}\n'.format(sys.argv[0])) + + +def main(): + with open("runs", "r") as f: + runs = json.load(f) + res = [{"result": x['result'], "endTime": dateutil.parser.parse(x['endTime'], ignoretz=True)} for x in runs if x['endTime']] + a_week_ago = datetime.datetime.now()-datetime.timedelta(days=7) + last_week_runs = filter(lambda x: x["endTime"] > a_week_ago, res) + fails = 0 + success = 0 + for x in last_week_runs: + if x['result'].lower() == 'success': + success += 1 + else: + fails += 1 + success_rate = float(success)*100 / (success + fails) + print("MXNet master CI pass rate {:.0f}%".format(success_rate)) + + + return 1 + +if __name__ == '__main__': + sys.exit(main()) + diff --git a/tools/jenkins-success-statistics/run.sh b/tools/jenkins-success-statistics/run.sh new file mode 100755 index 0000000..191d6b9 --- /dev/null +++ b/tools/jenkins-success-statistics/run.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +curl -v http://jenkins.mxnet-ci.amazon-ml.com/blue/rest/organizations/jenkins/pipelines/incubator-mxnet/branches/master/runs/ > runs