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

Function Talents: Incorrect TTL #47

Closed
nayakned opened this issue Apr 8, 2021 · 9 comments
Closed

Function Talents: Incorrect TTL #47

nayakned opened this issue Apr 8, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@nayakned
Copy link

nayakned commented Apr 8, 2021

The Function Talents in Python SDK are not working since the last set of pull requests.
The TTL of the talent being registered is apparently 0 and the ConfigManager gives out an error.

INFO [ConfigManager] : Discovery info of math is invalid. Errors: .config.outputs['math.multiply-in'].ttl should be >= 1000

This issue can be reproduced on the develop commit 6dd73b9

How to reproduce:

  1. Start the platform
docker-compose -f docker-compose.mosquitto.yml -f docker-compose.platform.yml up --remove-orphans
  1. Start the talent
src/sdk/python/examples/functions $ python run.py

This throws an error in the talent.

ERROR [ Talent.math-d35947e6 ]: An error occured. Code 4002 aa2e5c78-3655-4089-bc41-8ea809e674c1
@SebastianSchildt SebastianSchildt added the bug Something isn't working label Apr 8, 2021
@llakie
Copy link
Collaborator

llakie commented Apr 14, 2021

Which version of the SDK and the platform are you using? This is due to a setting in the JSON schema, which is used to validate incoming discovery responses. This was fixed quite a long time ago. Check the ttl property /resources/feature.schema.json it should read:
json "ttl": { "oneOf": [ { "type": "number", "const": 0 }, { "type": "number", "minimum": 1000 } ] }

This means: All values must be over 1000, with the exception of 0, which indicates a volatile feature.
Can you pleas check that?
If you cannot find the property like mentioned above, please upgrade to the latest version of develop.

@nayakned
Copy link
Author

I had tried earlier with the git commit 6dd73b9.
Now tried again with f9ec110. Also re-executed yarn after pulling the new set of commits.
The SDK version seems to be 0.4.0.
The problem persists however.

Interestingly, function talents in javascript work fine. The problem exists only in python SDK for me.

P.S.: How do I find the platform version? Unfortunately, the version is not mentioned in the log output.
Perhaps, it is a good idea to output the version number of the platform and SDK in the corresponding console outputs.

@nayakned
Copy link
Author

The resources/feature.schema.json shows the ttl property as follows:

"ttl": {
                    "oneOf": [
                        {
                            "type": "number",
                            "const": 0
                        },
                        {
                            "type": "number",
                            "minimum": 1000
                        }
                    ]
                },

@nayakned
Copy link
Author

nayakned commented Apr 14, 2021

@llakie
Copy link
Collaborator

llakie commented Apr 15, 2021

Your feature.schema.json seems to be correct. We have to treat function inputs and outputs as volatile features, which are not stored within an instance. Otherwise rulesets may evaluate wrong, if these values remain present.
Please leave it at 0 as it's written in the SDK. I will check out using the Python examples, why it does not work for you.

@llakie
Copy link
Collaborator

llakie commented Apr 15, 2021

P.S.: How do I find the platform version? Unfortunately, the version is not mentioned in the log output.
Perhaps, it is a good idea to output the version number of the platform and SDK in the corresponding console outputs.

The platform version can be retrieved from the package.json file

@wenwenchenbosch
Copy link

wenwenchenbosch commented Apr 15, 2021

@nayakned I just tested the function example with current develop branch 41ac311. I can not see the error. only some warning there:

2021-04-15T19:22:51.239Z WARNING [ hbmqtt.mqtt.protocol.handler ]: Unhandled exception: 'Lock' object is not iterable
2021-04-15T19:22:51.239Z WARNING [ hbmqtt.client ]: Connection failed: TypeError("'Lock' object is not iterable")

something goes wrong, right?

@wenwenchenbosch
Copy link

found out with @nayakned that my issues is because of using python3.9. hbmqtt is still not compatible with python3.9. see njouanin/hbmqtt#223

using python3.8.9, the python example works well

@nayakned
Copy link
Author

This problem looks to have been resolved in commit 45dfb0e.
Also confirmed by @wenwenchenbosch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants