Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a way to know how many seeds have been processed #7

Open
hacksysteam opened this issue Feb 10, 2017 · 0 comments
Open

Need a way to know how many seeds have been processed #7

hacksysteam opened this issue Feb 10, 2017 · 0 comments

Comments

@hacksysteam
Copy link
Contributor

In order version I used to do like:

    def go(self):
        try:
            print "[ +D+ ] - Start seed inserter."
            self.bs.use('seeds')
            i = 0
            for root, dirs, files in os.walk(self.seed_dir):
                for seed_name in files:
                    os.path.join(root, seed_name)
                    i += 1
                    if not self.seed_exists(seed_name):
                        with open(os.path.join(root, seed_name), 'r') as d:
                            seed_data = d.read()

                        data = {
                            'name': seed_name,
                            'data': seed_data
                        }

                        seed_pack = msgpack.packb(data, use_bin_type=True)

                        while True:
                            if self.bs.stats_tube('seeds')['current-jobs-ready'] < 20:
                                self.bs.put(seed_pack, 65536, 0, 600)
                                print "[ +{0:0{1}}+ ] - Pushed seed: {2}".format(i, 7, seed_name)
                                break
                            else:
                                sleep(1)
                    else:
                        print "[ +{0:0{1}}+ ] - Trace for seed exists in database: {2}".format(i, 7, seed_name)
        finally:
            self.bs.close()
            self.sql.close()
            print "[ +D+ ] - Finished seed inserter."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant