Maximo

 View Only
  • 1.  Size of automation script (jython) 1 MB

    Posted Thu December 14, 2023 05:36 PM

    Hello,

    We are on MAXIMO 7.6.1.3 and we are utilizing jython for the automation scripts. 

    We recently experienced that the size of the jython file should not exceed 1 MB. 

    If we separate out a few functions in the library script and invoke the library script for these function (instead of the keeping them in main file - thus reducing the size of the main automation script) from the main jython file, can we overcome this size limitation?  OR Is it the total of main file and the library script that counts for the 1 MB size?

    Has anybody experienced this issue and how you overcome this? I understand that the limit of 1 MB is hardcoded and it can not be changed.

    Please advice



    ------------------------------
    Pankaj Bhide
    ------------------------------


  • 2.  RE: Size of automation script (jython) 1 MB

    Posted Fri December 15, 2023 02:33 PM

    Pankaj,

    I want to make sure I preface my comment with this:  I do not want to come across as rude or insentive.  I understand that many Maximo customer have move customizations into Automation Scripts.  THAT is a good thing.  But as a business focused technologist I have to ask Why?  

    Why such a large automation script to begin with?  Think of this for just a moment....  one byte in ASCII is one character, such that "TEST" is four bytes. a regular express (such as a Carrige return) is also a single byte.  This means you have jython script that is a MILLION characters long.  WHY? the tis almost un managed bye to begin with from any given launch point perspective.  What are you trying to accomplish with such a large piece of executable code at run time?  I trust that you have already looked at the collection of automation scripts and have leveraged that. 

    So knowing that some scripts will CERTIANLY be large.... perhaps you can skinny down these as well?  Performance wise I would argue that several scripts call in succession will execute faster that on large script.  Curious to know what your thoughts are. Hope this helps.



    ------------------------------
    Bradley K. Downing , MBA
    Senior Brand Technical Specialist
    IBM
    Bakersfield CA
    ------------------------------



  • 3.  RE: Size of automation script (jython) 1 MB

    Posted Mon December 18, 2023 11:18 AM

    Hello,

    Thanks for your insight. The script that I am working on is not associate with any launch point (object/ attribute). We use this script for inserting/updating rows on work order related MBOs. We receive a json payload from a web application. We need to parse the content of the json, validate the contents of the json and upon successful validation insert and update rows in the work order related MBOs. 

    We are working on revising the longer script in the parts (e.g. split the functions in the separate files etc.). This way, we can probably overcome the size limitation.



    ------------------------------
    Pankaj Bhide
    ------------------------------



  • 4.  RE: Size of automation script (jython) 1 MB

    Posted Tue December 19, 2023 11:56 PM

    Pankaj,

    With my knowledge and experience around scripts, I would recommend not to have complex logic and lengthy code written in the scripts. You should rather explore the option of Java class here. I do understand that scripts give you the flexibility to add and run your code without much fuss and downtime but it is important to understand when we should write scripts and when to write java. With any complex logic and lengthy code, I would always go for Java so that you have a better control and code is also readable.

    Regards,

    Suhas



    ------------------------------
    Suhas Joshi
    Infosys
    Pune MH
    ------------------------------



  • 5.  RE: Size of automation script (jython) 1 MB

    Posted Mon December 18, 2023 03:33 AM

    Hi Pankaj,

    iirc the size limitation is 100k chars (or Byte) and not 1MB (-> https://bugs.jython.org/issue1744 ). I am pretty sure fragmenting your script will help, my small tests i just did look very good (comparing two 95K lorem-ipsum strings).

    We reached this limit with one of our crontask scripts (loading user/person data from a pretty complex AD) also, but had the luck that we could just change the intendation from spaces to tabs and saved a few thousand chars with it :) But even in that we are separating our code. We have a bunch of classes (LdapObject/LdapPerson/LdapAdminPerson, ICDPerson/ICDAdminPerson etc) that define our main logic to handle the different objects and have the runtime logic in a few functions. Sadly you can't import a multiple class-structure from a different script. This seems to only work for single classes.

    @Bradley: Do you have any proof that multiple small scripts are faster than one big one? 



    ------------------------------
    Andreas Brieke
    IT Service Management Consultant
    SVA System Vertrieb Alexander GmbH
    ------------------------------



  • 6.  RE: Size of automation script (jython) 1 MB

    Posted Thu December 21, 2023 05:24 AM

    As an alternative, i think we can use these methods in "big scrips" to call other scripts or even script functions with proper preparation of context object. 

    ScriptService.invokeScript(String aScriptName, Map<String, Object> context)


    ------------------------------
    Andrey Ilinskiy
    Handz.on
    https://www.on.de/
    München
    ------------------------------