Commit b24a92f6 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Missing work on perf runner.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1724 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0abe19d5
...@@ -11,11 +11,6 @@ from neo.tests.functional import NEOCluster ...@@ -11,11 +11,6 @@ from neo.tests.functional import NEOCluster
from neo.client.Storage import Storage from neo.client.Storage import Storage
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
SENDER = 'gregory@nexedi.com'
RECIPIENTS = ['gregory@nexedi.com'] #['neo-report@erp5.org']
SMTP_SERVER = ( "mail.nexedi.com", "25")
def runImport(neo, datafs): def runImport(neo, datafs):
def _copyTransactionsFrom(self, other): def _copyTransactionsFrom(self, other):
...@@ -96,7 +91,7 @@ def buildReport(dfs_size, elapsed, stats): ...@@ -96,7 +91,7 @@ def buildReport(dfs_size, elapsed, stats):
return (summary, report) return (summary, report)
def sendReport(summary, report): def sendReport(sender, recipients, server, summary, report):
""" Send a mail with the report summary """ """ Send a mail with the report summary """
import smtplib import smtplib
...@@ -106,18 +101,18 @@ def sendReport(summary, report): ...@@ -106,18 +101,18 @@ def sendReport(summary, report):
# build the email # build the email
msg = MIMEMultipart() msg = MIMEMultipart()
msg['Subject'] = summary msg['Subject'] = summary
msg['From'] = SENDER msg['From'] = sender
msg['To'] = ', '.join(RECIPIENTS) msg['To'] = ', '.join(recipients)
msg.epilogue = '' msg.epilogue = ''
msg.attach(MIMEText(report)) msg.attach(MIMEText(report))
# Send via smtp server # Send via smtp server
s = smtplib.SMTP() s = smtplib.SMTP()
s.connect(*SMTP_SERVER) s.connect(*server)
mail = msg.as_string() mail = msg.as_string()
for recipient in RECIPIENTS: for recipient in recipients:
try: try:
s.sendmail(SENDER, recipient, mail) s.sendmail(sender, recipient, mail)
except smtplib.SMTPRecipientsRefused: except smtplib.SMTPRecipientsRefused:
print "Mail for %s fails" % recipient print "Mail for %s fails" % recipient
s.close() s.close()
...@@ -149,6 +144,11 @@ if __name__ == "__main__": ...@@ -149,6 +144,11 @@ if __name__ == "__main__":
replicas = int(options.replica_count or 0) replicas = int(options.replica_count or 0)
datafs = options.datafs datafs = options.datafs
mail_server = options.server or '127.0.0.1:25'
mail_server = mail_server.split(':')
sender = options.sender
recipient = options.recipient
# start neo # start neo
neo = NEOCluster( neo = NEOCluster(
db_list=['test_import_%d' % i for i in xrange(storages)], db_list=['test_import_%d' % i for i in xrange(storages)],
...@@ -168,6 +168,6 @@ if __name__ == "__main__": ...@@ -168,6 +168,6 @@ if __name__ == "__main__":
print summary print summary
print report print report
if options.sender: if options.sender:
sendReport(summary, report) sendReport(sender, recipient, mail_server, summary, report)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment