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

rpc.py, line 117, ValueError if string is not standard #87

Open
exactstat opened this issue Feb 16, 2022 · 3 comments
Open

rpc.py, line 117, ValueError if string is not standard #87

exactstat opened this issue Feb 16, 2022 · 3 comments

Comments

@exactstat
Copy link

In the rpc.py, line 117, parsing error if a string is not standard, like this:
processname:websocket_vosk groupname:websocket_vosk pid:14 channel:stdout DEBUG - 2022-02-16 14:13:03,092 - __main__ - start - Trying to load model at: /opt/vosk-models/vosk-model-small-en-us-0.15 LOG (VoskAPI:ReadDataFiles():model.cc:213) Decoding params beam=10 max-active=3000 lattice-beam=2 LOG (VoskAPI:ReadDataFiles():model.cc:216) Silence phones 1:2:3:4:5:6:7:8:9:10

After splitting it looks like this:
['processname:websocket_vosk', 'groupname:websocket_vosk', 'pid:14', 'channel:stdout', 'LOG', '(VoskAPI:ReadDataFiles():model.cc:213)', 'Decoding', 'params', 'beam=10', 'max-active=3000', 'lattice-beam=2', 'LOG', '(VoskAPI:ReadDataFiles():model.cc:216)', 'Silence', 'phones', '1:2:3:4:5:6:7:8:9:10']


I use multivisor[rpc]

supervisord.conf:
`[rpcinterface:supervisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface

[supervisorctl]
serverurl=%(ENV_SUPERVISOR_SUPERVISORCTL_SERVERURL)s

[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=%(ENV_SUPERVISOR_RPCINTERFACE_MULTIVISOR_BIND)s`

@tiagocoutinho
Copy link
Owner

Thanks for the report @exactstat.

I assume you're referring to multivisor/rpc.py (cause there's also a multivisor/server/rpc.py)

What do you you mean by "string is not standard"?

Could you send the complete multivisor.conf and supervisor.conf files?

Looks like maybe you've already found a solution. Would you be willing to write a PR with a fix?

@exactstat
Copy link
Author

Hi, @tiagocoutinho !

Here is my sandbox project with all .conf files required. https://github.com/exactstat/api-sandbox.git (it's public)

Run the docker compose up and look at the std output:

image

I have a fix. I will create a pull request today.

@exactstat
Copy link
Author

I don't have access to the repo :)
Here is my fix in the multivisor/rpc.py in the _process_event(self, event) method.
I cut all characters after channel:stdout before parsing the payload_str. Because these characters contain logs with an unexpected structure that can't be parsed to a dict and probably should not be parsed.

if "channel:stdout" in payload_str:
            payload_str = payload_str.split("channel:stdout")[0]+"channel:stdout"
payload = dict((x.split(":") for x in payload_str.split()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants