Author: adc Date: Sat Aug 30 16:38:09 2014 New Revision: 1621492 URL: http://svn.apache.org/r1621492 Log: Incubator report timeline genertor
Added: labs/panopticon/pan-utils/src/asf/incubator/report.py labs/panopticon/pan-utils/tests/data/report.json labs/panopticon/pan-utils/tests/test_incubator_report.py Modified: labs/panopticon/pan-utils/tests/test_execute.py Added: labs/panopticon/pan-utils/src/asf/incubator/report.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/src/asf/incubator/report.py?rev=1621492&view=auto ============================================================================== --- labs/panopticon/pan-utils/src/asf/incubator/report.py (added) +++ labs/panopticon/pan-utils/src/asf/incubator/report.py Sat Aug 30 16:38:09 2014 @@ -0,0 +1,49 @@ +# +# 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. +# +import datetime + +PODLINGS_DUE_KEY = 'podlings-due' +SHEPHERDS_DUE_KEY = 'shepherds-due' +SUMMARY_DUE_KEY = 'summary-due' +MENTOR_SIGNOFF_DUE_KEY = 'mentor-signoff-due' +BOARD_SUBMISSION_KEY = 'board-submission' +BOARD_MEETING_KEY = 'board-meeting' + + +def generate_timeline(month, year=None): + """ Generate the set of deadlines for Incubator reporting + :param month: the month of the deadlines being generated + :param year: the month of the deadlines being generated, default is current year + :return dict: a dictionary of deadlines for Incubator reporting + """ + if year is None: + now = datetime.datetime.now() + year = now.year if month >= now.month else now.year + 1 + + for day in range(1, 8): + first_wed = datetime.date(day=day, month=month, year=year) + if first_wed.weekday() == 2: + break + + return {PODLINGS_DUE_KEY: first_wed, + SHEPHERDS_DUE_KEY: first_wed.replace(day=first_wed.day + 4), + SUMMARY_DUE_KEY: first_wed.replace(day=first_wed.day + 4), + MENTOR_SIGNOFF_DUE_KEY: first_wed.replace(day=first_wed.day + 6), + BOARD_SUBMISSION_KEY: first_wed.replace(day=first_wed.day + 7), + BOARD_MEETING_KEY: first_wed.replace(day=first_wed.day + 14)} Added: labs/panopticon/pan-utils/tests/data/report.json URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tests/data/report.json?rev=1621492&view=auto ============================================================================== --- labs/panopticon/pan-utils/tests/data/report.json (added) +++ labs/panopticon/pan-utils/tests/data/report.json Sat Aug 30 16:38:09 2014 @@ -0,0 +1,81 @@ +{ + "date": "2014-08", + "timeline": { + "podlings-due": "2014-08-06", + "sheherds-due": "2014-08-10", + "summary-due": "2014-08-10", + "mentor-signoff-due": "2014-08-12", + "board-submission": "2014-08-13", + "board-meeting": "2014-08-13" + }, + "sheperds": { + "optiq": "adc", + "twill": "adc", + "flink": "asavu", + "hdt": "asavu", + "sirona": "johndament", + "slider": "johndament" + }, + "podlings": { + "total": 31, + "additions": ["argus"], + "graduations": [], + "retirements": [] + }, + "pmc": { + "total": 201, + "additions": ["jani"], + "subtractions": [] + }, + "releases": { + "tez": ["0.4.1-incubating RC0"], + "slider": ["0.40-incubating RC0"], + "metamodel": ["incubating 4.2.0"], + "devicemap": ["incubating 1.4.1"], + "hdt": ["0.0.2.incubating (RC1)"] + }, + "ip-clearance": ["Brooklyn-CAMP-Server", "Sling-Query-contribution", "BigCouch-updates-to-Apache-CouchDB"], + "legal-trademarks": ["It is unclear whether Blur can get the Trademark assign document provided by trademarks@ signed by Near Infinity. The company no longer exists."], + "on-deck": ["argus", "parquet", "optiq", "sirona", "twill"], + "no-release": ["brooklyn", "fleece", "flink", "parquet"], + "reports": { + "argus": { + "graduation-issues": [ + "Get all podling committers and mentors on mailing lists", + "Publish initial code drop along with a code grant", + "Get approval for name of Argus (PODLINGNAMESEARCH-54)", + "Create a project website" + ], + "important-issues": ["part of the discussion about entering incubator, we added a second mentor (Daniel Gruno) from outside of Hortonworks."], + "community-development": [ + "podling accepted into incubator", + "all committers have ICLA filed and accounts created", + "Jira created", + "status page created", + "git repostiory created", + "mailing lists created" + ], + "project-development": [ + ["This is the first report"] + ], + "date-of-last-release": null, + "pmc": { + "total": 5, + "additions": ["jani"], + "subtractions": [] + }, + "committers": { + "total": 6, + "additions": ["jani"], + "subtractions": [] + }, + "mentor-sign-off": { + "gates": "2014-08-01", + "humbedooh": null, + "ddas": "2014-08-02", + "jghoman": "2014-08-03", + "omalley": "2014-08-04" + } + } + } +} \ No newline at end of file Modified: labs/panopticon/pan-utils/tests/test_execute.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tests/test_execute.py?rev=1621492&r1=1621491&r2=1621492&view=diff ============================================================================== --- labs/panopticon/pan-utils/tests/test_execute.py (original) +++ labs/panopticon/pan-utils/tests/test_execute.py Sat Aug 30 16:38:09 2014 @@ -24,7 +24,7 @@ from asf.utils.execute import execute, E def test_execute(): data_dir = os.path.join(os.path.dirname(__file__), 'data') stdout, stderr = execute(['ls', '%s' % data_dir]) - assert ['podlings.xml', 'test.apache.org'] == stdout + assert ['podlings.xml', 'report.json', 'test.apache.org'] == stdout assert [] == stderr Added: labs/panopticon/pan-utils/tests/test_incubator_report.py URL: http://svn.apache.org/viewvc/labs/panopticon/pan-utils/tests/test_incubator_report.py?rev=1621492&view=auto ============================================================================== --- labs/panopticon/pan-utils/tests/test_incubator_report.py (added) +++ labs/panopticon/pan-utils/tests/test_incubator_report.py Sat Aug 30 16:38:09 2014 @@ -0,0 +1,62 @@ +# +# 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. +# +import datetime + +import mock + +from asf.incubator import report + + +def test_generate_timeline(): + timeline = report.generate_timeline(9, year=2014) + + assert timeline[report.PODLINGS_DUE_KEY] == datetime.date(2014, 9, 3) + assert timeline[report.SHEPHERDS_DUE_KEY] == datetime.date(2014, 9, 7) + assert timeline[report.SUMMARY_DUE_KEY] == datetime.date(2014, 9, 7) + assert timeline[report.MENTOR_SIGNOFF_DUE_KEY] == datetime.date(2014, 9, 9) + assert timeline[report.BOARD_SUBMISSION_KEY] == datetime.date(2014, 9, 10) + assert timeline[report.BOARD_MEETING_KEY] == datetime.date(2014, 9, 17) + + +@mock.patch('datetime.datetime') +def test_generate_timeline_default_year(mock_datetime): + mock_datetime.now.return_value = datetime.date(2013, 8, 30) + + timeline = report.generate_timeline(9) + + assert timeline[report.PODLINGS_DUE_KEY] == datetime.date(2013, 9, 4) + assert timeline[report.SHEPHERDS_DUE_KEY] == datetime.date(2013, 9, 8) + assert timeline[report.SUMMARY_DUE_KEY] == datetime.date(2013, 9, 8) + assert timeline[report.MENTOR_SIGNOFF_DUE_KEY] == datetime.date(2013, 9, 10) + assert timeline[report.BOARD_SUBMISSION_KEY] == datetime.date(2013, 9, 11) + assert timeline[report.BOARD_MEETING_KEY] == datetime.date(2013, 9, 18) + + +@mock.patch('datetime.datetime') +def test_generate_timeline_next_year(mock_datetime): + mock_datetime.now.return_value = datetime.date(2013, 12, 25) + + timeline = report.generate_timeline(1) + + assert timeline[report.PODLINGS_DUE_KEY] == datetime.date(2014, 1, 1) + assert timeline[report.SHEPHERDS_DUE_KEY] == datetime.date(2014, 1, 5) + assert timeline[report.SUMMARY_DUE_KEY] == datetime.date(2014, 1, 5) + assert timeline[report.MENTOR_SIGNOFF_DUE_KEY] == datetime.date(2014, 1, 7) + assert timeline[report.BOARD_SUBMISSION_KEY] == datetime.date(2014, 1, 8) + assert timeline[report.BOARD_MEETING_KEY] == datetime.date(2014, 1, 15) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@labs.apache.org For additional commands, e-mail: commits-h...@labs.apache.org