Search - User list
Full Version: Releasing the license of houdini engine from HAPI
Root » Houdini Engine API » Releasing the license of houdini engine from HAPI
tpastyrik2k
Hi guys,

we have our own editor and we use Houdini engine API to talk to Houdini. Based on the documentation and HAPI comments in code, I have found out that:

- the license is acquired once HAPI_LoadAssetLibraryFromFile is called for the first time.
- HAPI_Cleanup: @note This does NOT release any licenses.

I have tried unloading all nodes, session, cleanup, yet until I kill our editor process, I can see my computer blocking the license in License Manager.

It looks like from API point of view there is no way how to release the license once it has been acquired, is that correct?

How can we achieve releasing the license as soon the user does not really need it anymore?

thank you
kind regards
Tom
seelan
HAPI_CloseSession is what you want.
https://www.sidefx.com/docs/hengine/_h_a_p_i_8h.html#ae01b3c9bea0eec15f618a1f56ab449bc [www.sidefx.com]
tpastyrik2k
Hi,

that is exactly what I thought should be and what I tried, yet it does not work. After we are done with Houdini, we are
  • deleting all nodes using HAPI_DeleteNode
  • cleaning up session using HAPI_Cleanup
  • closing session using HAPI_CloseSession

All the above calls return HAPI_RESULT_SUCCESS.

Yet when I check the License Manager, my pc is still listed there (I am refreshing) until I actually kill my app.

And I am afraid that killing the process is currently the only way, I have found this hidden in the HAPI_Initialize() doc here:
https://www.sidefx.com/docs/hengine/_h_a_p_i__fundamentals.html [www.sidefx.com]

The mirror call to HAPI_Initialize() is HAPI_Cleanup(), which will cleanup the scene underneath. Note, HAPI_Cleanup() will not release any licenses acquired by the process. You'll need to restart the process to release the licenses.

Can you confirm this?

Thank you!
Cheers
Tom
seelan
I can confirm that HAPI_Cleanup then HAPI_CloseSession will close an out-of-process session, and release the license. Are you creating an in-process or out-of-process session? Try the latter if you haven't.

Looks like in-process sessions do not release the license when HAPI_CloseSession is called. I recommend using out-of-process Houdini Engine sessions, as all our shipped plugins are now doing that by default.
tpastyrik2k
I see, thank you. Can you please point me to an example? I have not found it in the docs.
seelan
https://www.sidefx.com/docs/hengine/_h_a_p_i__sessions.html [www.sidefx.com]

The testharcSimpleAutoSession:: open shows an example of creating an out-of-process pipe session. I believe the initial setup is the only difference in terms of API calls, and everything after is pretty much the same.

The following 2 APIs are the important bits:

HARC_TEST_SUCCESS( HAPI_StartThriftNamedPipeServer(
    &myServerOptions, myPipeName.c_str(), nullptr
));

HARC_TEST_SUCCESS( HAPI_CreateThriftNamedPipeSession(
    &mySession,
    myPipeName.c_str()
));
tpastyrik2k
Thanks seelan, this is helpful! I have also got inspired by your unity plugin and got it working.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB