Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Multiple Python Modules #1845
Comments
|
The code that sets the python path basicly looks like this: path = talloc_strdup(NULL, inst->python_path);
PySys_SetPath(path);
talloc_free(path);There is no reference to the actual interpreter that should be used here, so I guess this is a kind of global setting. I can't really find any information on how to set the path for a specific interpreter (which still would be flawed, because the A possible option would to move the python path out of the instance config to a global setting, but this doesn't really fit well with the config format used in Freeradius. Is it possible to set the Python path from within a script? In that case I guess the best solution here would be to encourage that, and eventually drop the |
|
Yeah I remember it being global. Maybe just complain that it's already set? |
|
...and yes Python really doesn't embed well. |
That can still cause some unexpected behaviour. Imagine this config
This won't issue any complaints because we only set it once, but suddenly your python_stable call uses the testing libraries. |
|
Refuse to start if it's not set to the same value across all instances. |
|
I'll have a look whether or not the python3 module still has the same issue, as soon as I've fixed some other issues. |
I'm afraid that's the only working option left. Then again, I would probably start cursing at my monitor when I would get that as a config error, it would just feel a bit retarded. |
alandekok
added a commit
that referenced
this issue
Feb 27, 2017
|
|
alandekok |
70f66a3
|
alandekok
added defect v4.0.x
labels
Feb 27, 2017
|
I've pushed documentation to help. For now, I don't think it's worth fixing v3. This may be easier to fix in v4. |
erindru
commented
Apr 27, 2017
|
So right now, theres no way of instantiating multiple python modules in v3? Thats a bugger - I have a throughput issue where I have used the python module to make an AMQP request to another service authenticate the user. However, its become a bottleneck because it has to block and wait for a reply, which means it quickly becomes overloaded when for example a NAS restarts and ~100 users reauthenticate at the same time I was hoping to be able to instantiate multiple instances of the python module and use the |
|
In reply to @erindru
That's not what this case is about. It's perfectly possible possible to instantiate to have multiple Python modules, just as long as every module uses the same python_path. This looks like a limitation in Python itself, a few workarounds have been discussed here, but none of them really work.
This kind of things might be easier with the
Wouldn't just increasing the number of threads fix this (or is the python module not thread safe?) |
|
@erindru You can instantiate multiple python modules but it won't improve performance because you're stuck with a single interpreter. If you're really suffering from blocking the async rlm_rest module in v4.0.x allows many thousands of concurrent requests. |
|
LDAP would benefit from a global configuration section as well. @alandekok What do you think about having
and an extra global instantiation callback in the modules? There's just some stuff which doesn't belong in module instance configs and needs to be set globally. |
|
but I might only want debug to be higher on just one LDAP instance...
could still have module specific override?
alan
…
|
|
Templates already do that to a large extent, tho people don't use them a lot. |
|
@alanbuxey no, and you can't today. The point is there are some configuration items which map to library level settings, so they shouldn't really be set in module instances. They're global to the server. |
|
I do (use templates). When there are multiple servers in a failover pool
and they share common settings they are a very powerful/useful setting :)
alan
…
|
|
Excerpt from eap:
Excerpt from rest
These are just the first two things that came to my mind when thinking about having some global setting and a possibility to override them. |
|
Offline discussion. Decided on a library section which gets passed to the load callback in modules. |
sword2100 commentedNov 14, 2016
•
edited
Issue type
Defect description
Using SLES 12 SP1 with github source compiled version 3.0.13
Trying to use multiple python modules/files.
I have created two python files:
/usr/local/etc/raddb/mods-config/python/one.py
/usr/local/etc/raddb/mods-config/python/two.py
Changed the needed lines at python module
And added to the default server
Running FreeRadius with radius -XXX and get this message
It looks like for the second module the python_path is not working.
I've already tried to export the PYTHONPATH="[as in module]" but same message.