Controlling win service via toolkit app

Hi, there, world wide Shotgunners!

Here’s the case we’d like to get any help with:

We need to launch windows service on tk-desktop startup after configuration resolving ( with project context ). We created custom app and implemented init_app() and destroy_app() methods.

As we test it, init_app() method executes successfully, but destroy_app() method didn’t invoked at all. And both magic methods _ _ del_ _ and _ _ delete _ _ seems not invoked as well.

We found some related topics here:
https://groups.google.com/a/shotgunsoftware.com/forum/#!msg/shotgun-dev/xcgC3vXHE8U/HBDLuy0wBAAJ
https://groups.google.com/a/shotgunsoftware.com/d/msg/shotgun-dev/uWzVHqh_DJM/1GgJxU68CAAJ

but didn’t found the answers we need.

We want to take control over our app destruction for stopping service gracefully, when user click on [back_to_projects_arrow] in SG Desktop Application.

So, we wonder if any one actually did something similar?
Any advice would be greatly appreciated!

Best,

Alex

3 Likes

Hi Alex

I’ve chatted with an engineer, it seems we are just killing the process rather than shutting the engine down.
Looks like we need to add an engine.destroy() here:

I’ll send this to our product team, however if I get time I’ll see if I can put a pull request together.

Thanks
Phil

3 Likes

Thanks, Philip!
Will give it a try.

1 Like

Hi Alex

I just had a go here, but I now don’t think this is going to work. The engine stays alive until the app is closed. For example if you enter a project, open the publish app, exit the project (without closing the publish app), then the publish app continues to function. This is the intended behaviour.

So even if we did add in a destroy engine call, it would only get called after the app had been closed.

Is your app a GUI app? You could implement the closeEvent method and then run your clean up code.

1 Like

Thanks, Philip!
We’ve abandoned this idea and shifted to the app start (by the user) after project configuration loads. Anyway, thank you for your reply!

Cheers!

2 Likes