actinia-core icon indicating copy to clipboard operation
actinia-core copied to clipboard

Unpickling of resources created with actinia < 1.0.0 fails with actinia > 1.0.0

Open mmacata opened this issue 3 years ago • 2 comments

When requesting the resources endpoint (e.g. http://127.0.0.1:8088/api/v1/resources/demouser/resource_id-6e5a5224-2cf1-4aaf-b7d4-a006bccd3556), it currently leads to 500 - Internal Server Error when entries are contained which were created with actinia < 1.0.0. The reason is a failure to unpickle the redis entry. One example is

b'\x80\x04\x95\x19\x03\x00\x00\x00\x00\x00\x00]\x94(K\xc8\x8c-actinia_core.resources.common.response_models\x94\x8c\x17ProcessingResponseModel\x94\x93\x94)\x81\x94(\x8c\x06status\x94\x8c\x08accepted\x94\x8c\x07user_id\x94\x8c\x08demouser\x94\x8c\x0bresource_id\x94\x8c0resource_id-6e5a5224-2cf1-4aaf-b7d4-a006bccd3556\x94\x8c\x10accept_timestamp\x94GA\xd8\x1f\xb2\xd4d\xd7:\x8c\x0faccept_datetime\x94\x8c\x1a2021-04-20 12:38:41.575638\x94\x8c\ttimestamp\x94GA\xd8\x1f\xb2\xd4d\xf4\x03\x8c\x08datetime\x94\x8c\x1a2021-04-20 12:38:41.577394\x94\x8c\x07message\x94\x8c\x11Resource accepted\x94\x8c\ntime_delta\x94G?\\\xeb\x00\x00\x00\x00\x00\x8c\x0fprocess_results\x94}\x94\x8c\x12process_chain_list\x94]\x94\x8c\thttp_code\x94K\xc8\x8c\x04urls\x94h\x01\x8c\x08UrlModel\x94\x93\x94)\x81\x94(\x8c\tresources\x94]\x94h\x05\x8cghttps://actinia.mundialis.de/api/v1/resources/demouser/resource_id-6e5a5224-2cf1-4aaf-b7d4-a006bccd3556\x94u\x8c\x08api_info\x94h\x01\x8c\x0cApiInfoModel\x94\x93\x94)\x81\x94(\x8c\x08endpoint\x94\x8c\x1eawssentinel2adownloadlinkquery\x94\x8c\x06method\x94\x8c\x04POST\x94\x8c\x04path\x94\x8c\x1c/api/v1/sentinel2a_aws_query\x94\x8c\x0brequest_url\x94\x8c7http://actinia.mundialis.de/api/v1/sentinel2a_aws_query\x94uue.'

Unfortunately not very readable but revealing the old path for the response model class which was passed during preprocessing (or other steps in resource_base). When unpickling this old entry, it crashes with *** ModuleNotFoundError: No module named 'actinia_core.resources'

Solutions / Workarounds:

  • No endpoint exists to clear this via api call
  • Manually remove all resources from redis db. If connection to redis is possible via command line, this can be done via redis-cli -h $REDIS_HOST -a $REDIS_PW KEYS "RESOURCE-ID*" | xargs redis-cli -h $REDIS_HOST -a $REDIS_PW DEL
  • Wait until the expire time is over and the ressource is deleted (defaul 100d) :upside_down:

mmacata avatar Jul 01 '21 13:07 mmacata

I think this should be added to the release notes of v1.0.0

marcjansen avatar Jul 02 '21 06:07 marcjansen

Good point, I linked it under the respective changes.

mmacata avatar Jul 06 '21 14:07 mmacata