import os
import sys
from library.python.nyt import client as nyt_client
nyt_client.initialize(sys.argv)

from datacloud.features.dssm.sample_app import retro_grep


def main():

    import yt.wrapper as yt_wrapper
    yt_wrapper.config.set_proxy('hahn')
    yt_wrapper.run_sort(
        '//projects/scoring/beeline/XPROD-1417/input_yuid',
        '//tmp/r9-sorted-ext-table',
        sort_by='yuid'
    )

    print('Start grep!')
    retro_grep.get_retro_logs(
        os.environ['YT_TOKEN'],
        'hahn',
        '//tmp/r9-sorted-ext-table',
        [
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-01',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-02',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-03',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-04',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-05',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-06',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-07',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-08',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-09',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-10',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-11',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-12',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-13',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-14',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-15',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-16',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-17',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-18',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-19',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-20',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-21',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-22',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-23',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-24',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-25',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-26',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-27',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-28',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-29',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-30',
            '//home/x-products/production/datacloud/grep/spy_log/2016-07-31',
        ],
        '//tmp/r9-sample-retrp-grep'
    )
    print('Done!')


if __name__ == '__main__':
    main()
