def main(): import baker baker.command(parse) baker.command(save) baker.run()
FOOTER_FORMAT = '%10s %20d\n' @baker.command def benchmark(producer, topic, times=100, key_prefix='test_'): if producer not in PRODUCERS: sys.stderr.write("Producer must be one of: %s\n" % "|".join(PRODUCERS.keys())) sys.exit(1) kafka_producer = PRODUCERS[producer]() sys.stdout.write(HEADER_FORMAT % ('#', producer)) total_time = 0 for n in range(1, times + 1): key = key_prefix + str(n) value = 'Message ' + str(n) + '\n' + SAMPLE_PAYLOAD ms = kafka_producer.produce(topic, value, key) total_time += ms sys.stdout.write(ITEM_FORMAT % (n, ms)) done_ms = kafka_producer.done() total_time += done_ms sys.stdout.write(FOOTER_FORMAT % ('done()', done_ms)) sys.stdout.write(FOOTER_FORMAT % ('Total', total_time)) sys.stdout.write(FOOTER_FORMAT % ('Avg', total_time / times)) baker.run()
IPython.embed() imap.stop() sunriver.stop() @baker.command def send(account_email, to, subject, body): """ python Mail.py send --account_email="*****@*****.**" --to="*****@*****.**" --subject="subject test" --body="body test" """ from sr_automation.utils.TimeIt import TimeIt from sr_automation.platform.sunriver.Sunriver import Sunriver from sr_automation.platform.sunriver.applications.IMAPApp.IMAPApp import IMAPApp sunriver = Sunriver() sunriver.desktop.start() imap = IMAPApp(sunriver) imap.start() mail = LinuxMail(sunriver.linux) mail.choose_email(account_email).choose_folder("inbox") mail.send( to = to , subject = subject , body = body ) imap.stop() sunriver.stop() baker.run()
def main(): """Application main.""" baker.run()
def main(): baker.run()
def main(argv): baker.run()
user_id = config.get('freckle', 'user_id') projects = ','.join(project_list.values()) projects = quote(projects) req = Request(url='http://aquameta.letsfreckle.com/api/entries.json?search[from]=%s&search[to]=%s&search[people]=%s&search[billable]=%s&search[projects]=%s' % (start, end, user_id, billable, projects), headers={'X-FreckleToken': token}) try: response = urlopen(req) report = json.loads(response.read()) total_minutes = sum(e['entry']['minutes'] for e in report) if total_minutes > 40*60: print "%s, %s" % (start, total_minutes - 40*60) except: import traceback import sys print "######################## Exception #############################" print '\n'.join(traceback.format_exception(*sys.exc_info())) print "################################################################" return 1 def get_week_days(year, week): d = date(year,1,1) if(d.weekday()>3): d = d+timedelta(7-d.weekday()) else: d = d - timedelta(d.weekday()) dlt = timedelta(days = (week-1)*7-1) return d + dlt, d + dlt + timedelta(days=6) run()
def main(self): try: baker.run() except TequilaException as e: self.logger.error(e.message)
def main(self): try: run() except BlackDogException as ex: self.logger.error(ex.message)
def run(): baker.run()
def main(): if len(sys.argv) == 1: baker.usage("run") baker.run()