Releasing the license of houdini engine from HAPI

   410   6   1
User Avatar
Member
4 posts
Joined: March 2019
Offline
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
User Avatar
Staff
316 posts
Joined: May 2017
Offline
HAPI_CloseSession is what you want.
https://www.sidefx.com/docs/hengine/_h_a_p_i_8h.html#ae01b3c9bea0eec15f618a1f56ab449bc [www.sidefx.com]
User Avatar
Member
4 posts
Joined: March 2019
Offline
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
Edited by TomPastk - March 25, 2019 05:09:47
User Avatar
Staff
316 posts
Joined: May 2017
Offline
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.
Edited by seelan - March 25, 2019 09:53:11
User Avatar
Member
4 posts
Joined: March 2019
Offline
I see, thank you. Can you please point me to an example? I have not found it in the docs.
User Avatar
Staff
316 posts
Joined: May 2017
Offline
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()
));
Edited by seelan - March 25, 2019 10:27:07
User Avatar
Member
4 posts
Joined: March 2019
Offline
Thanks seelan, this is helpful! I have also got inspired by your unity plugin and got it working.
  • Quick Links