Exemplo n.º 1
0
def main():
    today = datetime.datetime.now().date()
    yesterday = today - datetime.timedelta(days=1)

    parser = optparse.OptionParser()
    parser.add_option("--start-date",
                        dest = 'start_date',
                        action="store",
                        default= yesterday.strftime(dateFormat))
    parser.add_option('--end-date',
                        dest="end_date",
                        action="store",
                        default=today.strftime(dateFormat))
    parser.add_option('--row-count',
                        dest="row_count",
                        action="store",
                        type="int",
                        default=100)
    parser.add_option('--column-count',
                        dest='column_count',
                        action='store',
                        type='int',
                        default=100)
    parser.add_option('--send-mail',
                        dest='send_mail',
                        action='store_true')
    parser.add_option('--mail-to',
                        dest='mail_to',
                        action='store',
                        default='*****@*****.**')
    options, args = parser.parse_args()

    log.startLogging(sys.stdout)
    db.startService()
    mail_to = []
    if options.send_mail:
        mail_to = [x.strip() for x in options.mail_to.split(',')]
    d = getNewUserCount(options.start_date, options.end_date,
                        options.row_count, options.column_count, mail_to)

    def finish(x):
        reactor.stop()
        db.stopService()
    d.addErrback(log.err)
    d.addBoth(finish)
    reactor.run()
def main():
    parser = optparse.OptionParser()
    parser.add_option('-c', '--create', dest="create", action="store_true")
    parser.add_option('-d', '--update-data', dest='update', action="store_true")
    options, args = parser.parse_args()

    if options.create or options.update:
        log.startLogging(sys.stdout)
        db.startService()

        if options.create:
            d = createCF()
        elif options.update:
            d = updateData()

        def finish(x):
            db.stopService()
            reactor.stop()
        d.addErrback(log.err)
        d.addBoth(finish)

        reactor.run()
Exemplo n.º 3
0
        parentId = item['meta'].get('parent', None)

        if not parentId:
            yield search.solr.updateItemIndex(itemId, item, ownerOrgId)
        else:
            yield search.solr.updateItemIndex(itemId, item, ownerOrgId, conv=items[parentId])


if __name__ == '__main__':
    parser = optparse.OptionParser()
    parser.add_option('-i', '--index-items', dest="items", action="store_true")
    parser.add_option('-p', '--index-people', dest='people', action="store_true")
    options, args = parser.parse_args()

    if options.items or options.people:
        log.startLogging(sys.stdout)
        db.startService()
        if options.items:
            d = reindexItems()
        if options.people:
            d = reindexProfileContent()


        def finish(x):
            db.stopService()
            reactor.stop();
        d.addErrback(log.err)
        d.addBoth(finish)
        reactor.run()