Page 1 of 1

Deactivating chores in Architect takes time

Posted: Thu Nov 01, 2018 7:52 pm
by Wim Gielis
Hello all,

Last weekend I had to change a good number of chores in a rather big TM1 model, because of the clock that is reset 1 hour.
By doing that (in Architect) we have to deactivate the chore first, then change the settings, and activate the chore again.
Deactivating a chore can take a lot of time. I figured that this is because the whole tree of applications, cubes, dimensions, processes, chores, replications (which I always hide) is refreshed. It happens to be the case that in this model with a lot of objects (about 1,000 TI processes to name just 1 thing) refreshing the tree takes about half a minute or more. Pressing F5 also, because it's the same action.

Deactivating a chore is instantaneous if you first hide in the menu bar all objects except chores. In that case, very few objects are to be refreshed and hence it's quick. When you're done with the chores, make the objects visible again and you should be good.

On a related note, if anyone has a (free) utility with the REST API to change all/selected chore times with 1 hour (earlier or later) I would be very grateful !

Wim

Re: Deactivating chores in Architect takes time

Posted: Fri Nov 02, 2018 2:17 pm
by David Usherwood
I sometimes feel like a stuck record promoting TM1PY, but one of Marius' examples does exactly that:
https://github.com/cubewise-code/TM1py- ... 20chore.py
To repeat the key code:

Code: Select all

with TM1Service(**config['tm1srv01']) as tm1:
    # Read chore:
    c = tm1.chores.get('real chore')
    # Update properties
    c.reschedule(minutes=-3)
    c._frequency = ChoreFrequency(days=7, hours=22, minutes=5, seconds=1)
    c._execution_mode = 'MultipleCommit'
    c.activate()
    # Update the TM1 chore
    tm1.chores.update(c)
    

Re: Deactivating chores in Architect takes time

Posted: Fri Nov 02, 2018 2:44 pm
by jim wood
Excellent, thanks David. Btw shouldn't that be a broken record? :D

Re: Deactivating chores in Architect takes time

Posted: Sat Nov 03, 2018 12:09 pm
by Wim Gielis
Hi David,

Thank you. My question and your answer generated 2 new questions:
- would it be difficult to loop over chores ? Maybe also the active chores ?
- can we only use "c.reschedule(minutes=-1)" and not leave out the other statements (frequency, executionmode). These will not change anyway.

Re: Deactivating chores in Architect takes time

Posted: Sun Nov 04, 2018 7:59 am
by David Usherwood
It's Marius' (sample) code, not mine. I suggest you install Python and TM1PY and play around with it. My own view is that this is far and away the best way to use the REST API for most purposes. (I have made some progress with using TM1PY to integrate TM1 with PowerBI.)

Re: Deactivating chores in Architect takes time

Posted: Sun Nov 04, 2018 10:05 am
by Wim Gielis
Thank you David, I'll experiment when I get the time for it.

Re: Deactivating chores in Architect takes time

Posted: Mon Nov 05, 2018 11:09 am
by Edward Stuart
TM1PY, in my opinion, should be a starting point for anyone looking to get more involved with the REST Api.

That said, the challenge you have is re-setting chores according to Daily Saving Time. Handily enough one of the properties of a Chore in the REST Api is "DSTSensitive"

Below is Postman output of a GET request on https://<ServerName>:<PortNumber>/api/v1/Chores, I only have a single Chore in my Test system, this request would display all Chores in your model.

Code: Select all

{
    "@odata.context": "$metadata#Chores",
    "value": [
        {
            "@odata.etag": "W/\"5f9d4c8ff79b56ada8be83a9f434f3e12c961aa8\"",
            "Name": "TestChoreMyProcess",
            "StartTime": "2018-10-01T23:18:57Z",
            "DSTSensitive": false,
            "Active": false,
            "ExecutionMode": "SingleCommit",
            "Frequency": "P999DT00H00M00S",
            "Attributes": {
                "Caption": "TestChoreMyProcess"
            }
        }
    ]
}
The REST API documentation states that DSTSensitive is a Boolean operator
EntityType: Chore
Properties:
Name (Type: String)
StartTime (Type: DateTimeOffset)
DSTSensitive (Type: Boolean)
Active (Type: Boolean)
ExecutionMode (Type: ChoreExecutionMode)
Frequency (Type: Duration)
Attributes (Type: Attributes)
Depending on how you want to connect you could loop through all required Chores and set to True

Re: Deactivating chores in Architect takes time

Posted: Mon Nov 05, 2018 12:35 pm
by lotsaram
Edward Stuart wrote: Mon Nov 05, 2018 11:09 am
The REST API documentation states that DSTSensitive is a Boolean operator
EntityType: Chore
Properties:
Name (Type: String)
StartTime (Type: DateTimeOffset)
DSTSensitive (Type: Boolean)
Active (Type: Boolean)
ExecutionMode (Type: ChoreExecutionMode)
Frequency (Type: Duration)
Attributes (Type: Attributes)
Depending on how you want to connect you could loop through all required Chores and set to True
Be aware however that there's a bug in the REST API where the DSTSensitive property is ignored when updating a chore and is always set to false.

Re: Deactivating chores in Architect takes time

Posted: Wed Nov 07, 2018 8:22 am
by Wim Gielis
Thanks Lotsaram, that saves us from spending time on figuring out something that will not work.

Re: Deactivating chores in Architect takes time

Posted: Wed Nov 07, 2018 10:42 am
by lotsaram
Wim Gielis wrote: Wed Nov 07, 2018 8:22 am Thanks Lotsaram, that saves us from spending time on figuring out something that will not work.
Using TM1Py to reschedule chores +/- 1 hour works like a charm.
It is just that the chores will still be scheduled in UTC and not local time due to the bug in the rest API