SovereignEdgeEU-COGNIT / device-runtime-py

This repository holds the python implementation of the Device Runtime. The Device Runtime provides a SDK to enable the devices to communicate with the COGNIT platform to perform the task offloading.
Apache License 2.0
1 stars 1 forks source link

Error 422 when calling FaaS to create a Serverless Runtime #10

Open ambouhou opened 8 months ago

ambouhou commented 8 months ago

name: ERROR from "_prov_engine_client.py" & "serverless_runtime_context.py" about:


Current Behavior:

We are trying to use the example code available on the github to create a serverless runtime on the rise testbed and execute the example function (sum). We encounter several errors when running the "minimal_offload_sync.py" program:

(serverless-env) cognit-admin@cognit-device-runtime:~/device-runtime-py$ python3 examples/minimal_offload_sync.py
[2024-01-24 08:41:23,773] [WARNING] [_prov_engine_client.py::54] {'SERVERLESS_RUNTIME': {'NAME': 'Example Serverless Runtime', 'FAAS': {'CPU': 1, 'MEMORY': 768, 'DISK_SIZE': 3072, 'FLAVOUR': 'nature', 'ENDPOINT': ''}, 'SCHEDULING': {}, 'DEVICE_INFO': {}}}
[2024-01-24 08:41:23,774] [WARNING] [_prov_engine_client.py::56] Create [POST] URL: http://cognit-lab.sovereignedge.eu:1337/serverless-runtimes
[2024-01-24 08:41:24,498] [ERROR] [_prov_engine_client.py::65] Provisioning engine returned 422 on create
[2024-01-24 08:41:24,499] [ERROR] [serverless_runtime_context.py::138] Serverless Runtime creation request failed
[2024-01-24 08:41:24,499] [ERROR] [serverless_runtime_context.py::180] Serverless Runtime instance has not been requested yet
[2024-01-24 08:41:25,501] [ERROR] [serverless_runtime_context.py::180] Serverless Runtime instance has not been requested yet
[2024-01-24 08:41:26,502] [ERROR] [serverless_runtime_context.py::180] Serverless Runtime instance has not been requested yet

Expected Behavior:

We expect to receive from the provisioning engine, that the serverlessruntime has been created and started. e.g:

PE-SR-creation-response

We also expect to receive the result of the executed function. e.g : SR-execution-response

Steps To Reproduce:

  1. Make sure you have IPV6 access (ping ipv6.google.com)
  2. Follow the instructions provided in the Readme
  3. Modify the configuration file (cognit.yml) with valid credentials
  4. Execute the program "minimal_offload_sync.py"
  5. See error...

Environment:

zazola commented 8 months ago

Hi Malik, The issue you are having is due to the fact that you are using the default FLAVOUR that is hardcoded in the current version of the code (this will be configurable in the near future). You should change it to "Cybersec" in your case, to make use of the falvour created for your use case.

So the workaround to fix it, until the newer version is released in GitHub, should be modifying "nature" to "Cybersec" in: https://github.com/SovereignEdgeEU-COGNIT/device-runtime-py/blob/main/cognit/models/_prov_engine_client.py#L32