cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to upgrade thing template impacting thousands of things?

rattmice
13-Aquamarine

How to upgrade thing template impacting thousands of things?

We have a thing template that is used as the base template for 30k devices.  We just had to make a change to one of the thing shapes that is applied to that template and that shape is part of an external extension.  I can validate the extension in Composer in a matter of a few seconds.  However, when I try to officially import the extension it will fail after 10-15 minutes with no specific error in the application log.  My suspicion is that this is a thundering herd issue with all of those things attempting to be restarted simultaneously.

 

Is there a way to stop the devices, perform the extension import, then throttle the starting of those things in batches?

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To:rattmice)

Hello,

 

You could probably write a service that goes through all of your entities and disables them before doing the opposite and enabling them using these thing services:

 

jensc_0-1681974796516.png

 

But to be completely honest, I'm not entirely sure if this counts as "turning off" or if it is just in a disabled mode somehow.

Here is some documentation regarding this function.

 

Even if it doesn't turn it off, perhaps it won't do a restart automatically from the change of the shape so that you can do a controlled restart later on.

 

Regards,

Jens

View solution in original post

3 REPLIES 3
jensc
17-Peridot
(To:rattmice)

Hello,

 

You could probably write a service that goes through all of your entities and disables them before doing the opposite and enabling them using these thing services:

 

jensc_0-1681974796516.png

 

But to be completely honest, I'm not entirely sure if this counts as "turning off" or if it is just in a disabled mode somehow.

Here is some documentation regarding this function.

 

Even if it doesn't turn it off, perhaps it won't do a restart automatically from the change of the shape so that you can do a controlled restart later on.

 

Regards,

Jens

rattmice
13-Aquamarine
(To:jensc)

Jens,

 

Thank you for the suggestion and this actually works.  I initially wrote this as a single ThingWorx service but that needed to be run multiple times due to the script timeout so I am going to refactor a bit possibly invoking via an external microservice.  I will also need the reciprocal EnableThing and/or RestartThing to get them going after the update.

 

-Matt

jensc
17-Peridot
(To:rattmice)

Hello,

 

If you are okay with doing something async, you could also use the subscription function if the code times out.

Just having a looping service sending your thing name into a property and triggering subscription on the value change.

 

Or you could possibly use an async service, however I have never tried them myself so not exactly sure if they work something like async/await or not.

 

But glad my suggestion could help you!

 

Regards,

Jens

 

Announcements


Top Tags