| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2009 Google Inc. | 2 # Copyright 2009 Google Inc. |
| 3 # | 3 # |
| 4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 7 # | 7 # |
| 8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 # | 9 # |
| 10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if to_put and self._do_write: | 90 if to_put and self._do_write: |
| 91 db.put(to_put) | 91 db.put(to_put) |
| 92 actors_processed += len(actor_refs) | 92 actors_processed += len(actor_refs) |
| 93 logging.info("Processed %d actors...", actors_processed) | 93 logging.info("Processed %d actors...", actors_processed) |
| 94 q = self.get_actor_query() | 94 q = self.get_actor_query() |
| 95 q.filter("__key__ >", actor_refs[-1].key()) | 95 q.filter("__key__ >", actor_refs[-1].key()) |
| 96 actor_refs = q.fetch(batch_size) | 96 actor_refs = q.fetch(batch_size) |
| 97 | 97 |
| 98 | 98 |
| 99 def auth_function(): | 99 def auth_function(): |
| 100 return ("admin", getpass.getpass("Password:")) | 100 return (raw_input("Username: "), getpass.getpass("Password:")) |
| 101 | 101 |
| 102 def main(): | 102 def main(): |
| 103 parser = optparse.OptionParser() | 103 parser = optparse.OptionParser() |
| 104 parser.add_option("-b", "--actor_batch_size", dest="actor_batch_size", | 104 parser.add_option("-b", "--actor_batch_size", dest="actor_batch_size", |
| 105 default=100, | 105 default=100, |
| 106 help="number of actors to fetch in a single query") | 106 help="number of actors to fetch in a single query") |
| 107 parser.add_option("-w", "--write", dest="write", default=False, | 107 parser.add_option("-w", "--write", dest="write", action="store_true", |
| 108 help="write results back to data store") | 108 default=False, help="write results back to data store") |
| 109 parser.add_option("-a", "--app_id", dest="app_id", | 109 parser.add_option("-a", "--app_id", dest="app_id", |
| 110 help="the app_id of your app, as declared in app.yaml") | 110 help="the app_id of your app, as declared in app.yaml") |
| 111 parser.add_option("-s", "--servername", dest="servername", | 111 parser.add_option("-s", "--servername", dest="servername", |
| 112 help="the hostname your app is deployed on. Defaults to" | 112 help="the hostname your app is deployed on. Defaults to" |
| 113 "<app_id>.appspot.com") | 113 "<app_id>.appspot.com") |
| 114 (options, args) = parser.parse_args() | 114 (options, args) = parser.parse_args() |
| 115 remote_api_stub.ConfigureRemoteDatastore(app_id=options.app_id, | 115 remote_api_stub.ConfigureRemoteDatastore(app_id=options.app_id, |
| 116 path='/remote_api', | 116 path='/remote_api', |
| 117 auth_func=auth_function, | 117 auth_func=auth_function, |
| 118 servername=options.servername) | 118 servername=options.servername) |
| 119 | 119 |
| 120 ChannelCountBackfiller(options.write).run(int(options.actor_batch_size)) | 120 ChannelCountBackfiller(options.write).run(int(options.actor_batch_size)) |
| 121 | 121 |
| 122 if __name__ == "__main__": | 122 if __name__ == "__main__": |
| 123 main() | 123 main() |
| OLD | NEW |