You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@incubator.apache.org by jm...@apache.org on 2020/04/16 07:35:17 UTC

svn commit: r1876587 - in /incubator/public/trunk: email_monthly_template.txt report_email.py

Author: jmclean
Date: Thu Apr 16 07:35:16 2020
New Revision: 1876587

URL: http://svn.apache.org/viewvc?rev=1876587&view=rev
Log:
Add script to generate monthly reminder

Added:
    incubator/public/trunk/email_monthly_template.txt
    incubator/public/trunk/report_email.py

Added: incubator/public/trunk/email_monthly_template.txt
URL: http://svn.apache.org/viewvc/incubator/public/trunk/email_monthly_template.txt?rev=1876587&view=auto
==============================================================================
--- incubator/public/trunk/email_monthly_template.txt (added)
+++ incubator/public/trunk/email_monthly_template.txt Thu Apr 16 07:35:16 2020
@@ -0,0 +1,15 @@
+Dates for next board report:
+{}
+
+Expected to report this month are:
+{}
+
+Reports as usual can be submitted here [1]
+
+Thanks,
+Justin
+
+
+1. https://s.apache.org/incubator-report
+1. https://cwiki.apache.org/confluence/display/INCUBATOR/Report
+1. https://cwiki.apache.org/confluence/display/INCUBATOR/{}
\ No newline at end of file

Added: incubator/public/trunk/report_email.py
URL: http://svn.apache.org/viewvc/incubator/public/trunk/report_email.py?rev=1876587&view=auto
==============================================================================
--- incubator/public/trunk/report_email.py (added)
+++ incubator/public/trunk/report_email.py Thu Apr 16 07:35:16 2020
@@ -0,0 +1,99 @@
+#!/usr/bin/env python2.7
+
+# 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 json
+import email.utils
+from pprint import pprint
+import getpass
+from smtplib import SMTP_SSL as SMTP
+import datetime
+from datetime import timedelta 
+from dateutil.parser import parse
+from email.mime.text import MIMEText
+
+def findWednesday(d, weeks):
+    days_ahead = 2 - d.weekday()
+    if days_ahead < 0:
+        days_ahead += weeks * 7
+    else:
+        days_ahead += (weeks - 1) * 7 #we're on or after wednesday, give less time
+    return d + datetime.timedelta(days_ahead)
+
+fp = open('email_monthly_template.txt', 'rb')
+messageBody = fp.read()
+fp.close()
+
+with open('content/shepherd_assignments.json') as data_file:    
+    data = json.load(data_file)
+
+month = raw_input('Enter month, in the format of YYYY-MM: ')
+username = raw_input('Enter your ASF Username: ')
+password = getpass.getpass('Enter your ASF pw: ')
+
+podlingsToReport = data[month].keys()
+
+meFormat = '{}@apache.org'
+emailTo = 'general@incubator.apache.org'
+
+me = meFormat.format(username)
+
+thisMonth = parse(month + "-01")
+
+podlingReportsDue = findWednesday(thisMonth, 1)
+
+boardMeeting = findWednesday(thisMonth, 3)
+
+subjectDate = thisMonth.strftime("%B %Y")
+wikiPage = thisMonth.strftime("%B%Y")
+dueDateFormat = podlingReportsDue.strftime("%a, %B %d")
+boardMeetingFormat = boardMeeting.strftime("%a, %d %B %Y")
+
+print dueDateFormat
+print boardMeetingFormat
+
+dates = (
+    podlingReportsDue.strftime("%a %B %d") + " - Podling reports due by end of day\n" +
+    (podlingReportsDue + timedelta(days=4)).strftime("%a %B %d") + " - Shepherd reviews due by end of day\n" +
+    (podlingReportsDue + timedelta(days=4)).strftime("%a %B %d") + " - Summary due by end of day\n" +
+    (podlingReportsDue + timedelta(days=6)).strftime("%a %B %d") + " - Mentor signoff due by end of day\n" +
+    (podlingReportsDue + timedelta(days=7)).strftime("%a %B %d") + " - Report submitted to Board\n" +
+    (podlingReportsDue + timedelta(days=14)).strftime("%a %B %d") + " - Board meeting\n" 
+)
+
+toReport = ""
+for podling in podlingsToReport:
+    toReport = toReport + " - " + podling + "\n"
+
+emailBodyString = messageBody.format(dates, toReport, wikiPage)
+
+s = SMTP('mail-relay.apache.org')
+s.login(username, password)
+print "connected"
+mailTo = "general@incubator.apache.org"
+msgId = email.utils.make_msgid()
+msg = MIMEText(emailBodyString)
+msg['Subject'] = ' [MENTORS] ' + subjectDate.split(' ')[0] + ' report timeline - reports due ' + subjectDate
+msg['From'] = me
+msg['Date'] = email.utils.formatdate()
+msg['To'] = emailTo
+msg['Message-ID'] = msgId
+s.sendmail(me, [emailTo], msg.as_string())
+print msg['Subject']
+print msg.as_string()
+print(' sent ',msgId,' to ',mailTo,' via ',me)
+s.quit()
+



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org