Ejemplo n.º 1
0
def main():

    import baker

    baker.command(parse)
    baker.command(save)

    baker.run()
Ejemplo n.º 2
0
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()
Ejemplo n.º 4
0
        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()

Ejemplo n.º 5
0
Archivo: app.py Proyecto: abingham/stag
def main():
    """Application main."""
    baker.run()
Ejemplo n.º 6
0
def main():
    baker.run()
Ejemplo n.º 7
0
def main():
    baker.run()
def main(argv):
    baker.run()
Ejemplo n.º 9
0
    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()
Ejemplo n.º 10
0
 def main(self):
     try:
         baker.run()
     except TequilaException as e:
         self.logger.error(e.message)
Ejemplo n.º 11
0
 def main(self):
     try:
         run()
     except BlackDogException as ex:
         self.logger.error(ex.message)
Ejemplo n.º 12
0
def run():
    baker.run()
Ejemplo n.º 13
0
def main():
    if len(sys.argv) == 1:
        baker.usage("run")
    baker.run()
Ejemplo n.º 14
0
def run():
    baker.run()
Ejemplo n.º 15
0
 def main(self):
     try:
         baker.run()
     except TequilaException as e:
         self.logger.error(e.message)
Ejemplo n.º 16
0
def main(argv):
    
    baker.run()