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
from neo.client.Storage import Storage
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 _copyTransactionsFrom(self, other):
......@@ -96,7 +91,7 @@ def buildReport(dfs_size, elapsed, stats):
return (summary, report)
def sendReport(summary, report):
def sendReport(sender, recipients, server, summary, report):
""" Send a mail with the report summary """
import smtplib
......@@ -106,18 +101,18 @@ def sendReport(summary, report):
# build the email
msg = MIMEMultipart()
msg['Subject'] = summary
msg['From'] = SENDER
msg['To'] = ', '.join(RECIPIENTS)
msg['From'] = sender
msg['To'] = ', '.join(recipients)
msg.epilogue = ''
msg.attach(MIMEText(report))
# Send via smtp server
s = smtplib.SMTP()
s.connect(*SMTP_SERVER)
s.connect(*server)
mail = msg.as_string()
for recipient in RECIPIENTS:
for recipient in recipients:
try:
s.sendmail(SENDER, recipient, mail)
s.sendmail(sender, recipient, mail)
except smtplib.SMTPRecipientsRefused:
print "Mail for %s fails" % recipient
s.close()
......@@ -149,6 +144,11 @@ if __name__ == "__main__":
replicas = int(options.replica_count or 0)
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
neo = NEOCluster(
db_list=['test_import_%d' % i for i in xrange(storages)],
......@@ -168,6 +168,6 @@ if __name__ == "__main__":
print summary
print report
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