our systems folk use a 'simple' line to let them know how many licenses are checked out to how many we have total:

lmutil lmstat -a -c <port@license server> | grep "Users of nuke_i" | awk '{print "Nuke:\t" $11 "/" $6}'

of course, "lmutil lmstat -a -c <port@license server>" is the part that you are probably looking for so you can do whatever you want with that output, for example (assuming communicate doesn't lock):

import subprocess
p = subprocess.Popen(['lmutil', 'lmstat', '-a', '-c', 'port@yourLicenseServer'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
output = out.strip().split('\n')

for l in output:
    if 'Users of nuke_r' in l:
        renderLine = l
        break

issued = ''
used = ''
for n in renderLine.split():
    if n.isdigit():
        if not issued:
            issued = n
        used = n

if used==issued:
    sys.exit('No available Nuke render licenses')

jrab

On 01/05/2015 09:29 AM, Timm Wagener wrote:
Hey Nathan,

thanks for your reply. I quickly checked lmutil -h and rlm -h on the command line to see the available options
to check for a license, but found it quite convoluted.
Would you mind sharing the command line parms you use to query the license information for a render license on nuke for example?

Thanks,
Timm

On Mon, Jan 5, 2015 at 7:32 AM, Nathan Rusch <[email protected]> wrote:
I think the only way to do this would be to shell out to lmutil/rlmutil to query the license server and then parse the output, which we do to display license information in a GUI. I’ve submitted a feature request to have the nuke module raise an exception rather than abort the process if a license cannot be checked out, and I’ll reply again once I have a feature ID.
 
-Nathan

 
Sent: Tuesday, December 30, 2014 2:02 PM
Subject: [Nuke-python] [Nuke8.05] Querying available render licenses frompython
 
Hello guys,
 
i'd like to ask if it is possible from within the nuke python packages to query the license server for the currently available render licenses?
 
Research in the interwebs told me that this doesnt seem to be possible yet! 
The big issue that I can’t seem to get around is that import nuke will exit python if there aren’t any available Nuke render licenses. This exit doesn’t call a SystemExit exception, and isn’t any of the __builtin__ exit calls or the os._exit and thread.exit calls. Depending on the license server configuration, one should be able to query the server to see if there are licenses, and only continue if one is available.
 
Is this still the case or are there any hidden tricks/best practices how to query if a license is available? If not through python, maybe through the NDK?
 
Thanks and a happy new year everybody :D
Timm
 
--
Timm Wagener
Technical Artist / 3D Generalist

www.timmwagener.com

Email:
[email protected]

Phone:
0178-2810920



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python




--
Timm Wagener
Technical Artist / 3D Generalist

www.timmwagener.com

Email:
[email protected]

Phone:
0178-2810920




_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python


_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to