2015-12-06 1 views
2

Я пытаюсь загрузить CSV-файл в GAE, но с ошибками. Я следую за сообщением this и используя тот же самый файл yml. Я могу загрузить данные, но команда загрузки дает следующие ошибки:Ошибка при загрузке csv в Google App Engine

C:\Users\ADMIN>appcfg.py upload_data --config_file=C:\bulk\config.yml --file 
name=C:\bulk\data.csv --url=http://encryptedsearch.appspot.com/remote_api --appl 
ication=encryptedsearch --kind=Greeting 
06:44 PM Uploading data records. 
[INFO ] Logging to bulkloader-log-20151206.184424 
[INFO ] Throttling transfers: 
[INFO ] Bandwidth: 250000 bytes/second 
[INFO ] HTTP connections: 8/second 
[INFO ] Entities inserted/fetched/modified: 20/second 
[INFO ] Batch Size: 10 
[INFO ] Opening database: bulkloader-progress-20151206.184424.sql3 
2015-12-06 18:44:24,763 INFO client.py:669 access_token is expired. Now: 2015-12 
-06 13:44:24.763000, token_expiry: 2015-12-05 20:24:05 
2015-12-06 18:44:25,891 INFO client.py:669 access_token is expired. Now: 2015-12 
-06 13:44:25.891000, token_expiry: 2015-12-05 20:24:05 
2015-12-06 18:44:26,576 INFO client.py:669 access_token is expired. Now: 2015-12 
-06 13:44:26.577000, token_expiry: 2015-12-05 20:24:05 
2015-12-06 18:44:27,687 INFO client.py:669 access_token is expired. Now: 2015-12 
-06 13:44:27.687000, token_expiry: 2015-12-05 20:24:05 
Traceback (most recent call last): 
    File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 133, in 
<module> 
    run_file(__file__, globals()) 
    File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 129, in 
run_file 
    execfile(_PATHS.script_file(script_name), globals_) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap 
pcfg.py", line 5469, in <module> 
    main(sys.argv) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap 
pcfg.py", line 5460, in main 
    result = AppCfgApp(argv).Run() 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap 
pcfg.py", line 3010, in Run 
    self.action(self) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap 
pcfg.py", line 5116, in __call__ 
    return method() 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap 
pcfg.py", line 4919, in PerformUpload 
    run_fn(args) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap 
pcfg.py", line 4803, in RunBulkloader 
    sys.exit(bulkloader.Run(arg_dict, self._GetOAuth2Parameters())) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu 
lkloader.py", line 4349, in Run 
    return _PerformBulkload(arg_dict, oauth2_parameters) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu 
lkloader.py", line 4211, in _PerformBulkload 
    loader.finalize() 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\bulk 
load\bulkloader_config.py", line 383, in finalize 
    self.reserve_keys(self.keys_to_reserve) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu 
lkloader.py", line 1211, in ReserveKeys 
    datastore._GetConnection()._reserve_keys(ConvertKeys(keys)) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor 
e\datastore_rpc.py", line 2172, in _reserve_keys 
    self._async_reserve_keys(None, keys).get_result() 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor 
e\datastore_rpc.py", line 2210, in _async_reserve_keys 
    service_name=_DATASTORE_V4)) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor 
e\datastore_rpc.py", line 1341, in _make_rpc_call 
    rpc = self._create_rpc(config, service_name) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor 
e\datastore_rpc.py", line 1236, in _create_rpc 
    rpc = apiproxy_stub_map.UserRPC(service_name, deadline, callback) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip 
roxy_stub_map.py", line 414, in __init__ 
    self.__rpc = CreateRPC(service, stubmap) 
    File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip 
roxy_stub_map.py", line 68, in CreateRPC 
    assert stub, 'No api proxy found for service "%s"' % service 
AssertionError: No api proxy found for service "datastore_v4" 

я отправляю тот же файл обратно в хранилище данных, который я скачал с помощью команды:

appcfg.py download_data --config_file=C:\bulk\config.yml --filename=C:\bulk\data.csv --kind=Greeting --url=http://encryptedsearch.appspot.com/remote_api --application=encryptedsearch 

Мой config.yml находится ниже:

# Autogenerated bulkloader.yaml file. 
# You must edit this file before using it. TODO: Remove this line when done. 
# At a minimum address the items marked with TODO: 
# * Fill in connector and connector_options 
# * Review the property_map. 
# - Ensure the 'external_name' matches the name of your CSV column, 
#  XML tag, etc. 
# - Check that __key__ property is what you want. Its value will become 
#  the key name on import, and on export the value will be the Key 
#  object. If you would like automatic key generation on import and 
#  omitting the key on export, you can remove the entire __key__ 
#  property from the property map. 

# If you have module(s) with your model classes, add them here. Also 
# change the kind properties to model_class. 
python_preamble: 
- import: base64 
- import: re 
- import: google.appengine.ext.bulkload.transform 
- import: google.appengine.ext.bulkload.bulkloader_wizard 
- import: google.appengine.api.datastore 
- import: google.appengine.api.users 

transformers: 

- kind: Greeting 
    connector: csv 

    connector_options: 
    # TODO: Add connector options here--these are specific to each connector. 
    property_map: 
    - property: __key__ 
     external_name: key 
     import_transform: transform.key_id_or_name_as_string 

    - property: content 
     external_name: content 
     # Type: String Stats: 7 properties of this type in this kind. 

    - property: date 
     external_name: date 
     # Type: Date/Time Stats: 7 properties of this type in this kind. 
     import_transform: transform.import_date_time('%Y-%m-%dT%H:%M:%S') 
     export_transform: transform.export_date_time('%Y-%m-%dT%H:%M:%S') 

    - property: name 
     external_name: name 
     # Type: String Stats: 7 properties of this type in this kind. 

содержимое CSV файла:

content,date,name,key 
Hi,2015-12-05T17:24:14,,ahFzfmVuY3J5cHRlZHNlYXJjaHIrCxIJR3Vlc3Rib29rIgdkZWZhdWx0DAsSCEdyZWV0aW5nGICAgICAgIAKDA 
3rd,2015-12-05T17:30:04,,ahFzfmVuY3J5cHRlZHNlYXJjaHIrCxIJR3Vlc3Rib29rIgdkZWZhdWx0DAsSCEdyZWV0aW5nGICAgICA8ogKDA 
2nd,2015-12-05T17:25:59,,ahFzfmVuY3J5cHRlZHNlYXJjaHIrCxIJR3Vlc3Rib29rIgdkZWZhdWx0DAsSCEdyZWV0aW5nGICAgICA5JEKDA 

Datastore записей:

link to image

+0

любая подсказка о том, как обновить токен доступа? – Bill

+0

Является ли ваша машина Windows в корпоративной среде позади прокси? –

+0

Я так не думаю. – Bill

ответ

2

Для всех остальных, которые борются с той же проблемой. Я обнаружил, что для меня не было другого решения, кроме как комментировать эту строку в фактическом client.py.

Решение:

  • найти файл client.py (../google-cloud-sdk/platform/google_cloud/lib/oauth2client/oauth2client/client.py в моем случае)
  • навигации по access_token_expired() метод
  • комментарий следующий код:

    if now >= self.token_expiry: 
        logger.info('access_token is expired. Now: %s, token_expiry: %s', 
          now, self.token_expiry) 
        return True