Rocket U2 | UniVerse & UniData

 View Only
  • 1.  Integration Django with u2 python

    Posted 12-07-2023 10:41

    I've created the U2 Python program, which is  with the Universe. My current challenge is figuring out how to seamlessly integrate U2 Python (Universe) with Django. Could you please provide guidance or steps on how to achieve this integration?



    ------------------------------
    Gnanaseelan gnanapirakasam
    SSE
    Rocket Forum Shared Account
    ------------------------------


  • 2.  RE: Integration Django with u2 python

    Posted 12-10-2023 07:39
    Edited by John Jenkins 12-10-2023 07:39

    Gnaneseelan,

    There are  anumber of blog and technical articles that may be of use - please review:

    There are also some worked examples of invoking Python code in the XDEMO account which is included with the installation which might be of assistance if you are just starting out with UniVerse and Python.

    UniVerse provides the interfaces and hooks for invoking Python modules, one you are in Python then the environment is wholly Python-based.

    On the Python side, UniVerse provides hooks and interfaces where Python functions can invoke UniVerse functionality. Both these mechanisms are in the XDEMO sample accounts. You should also be aware of the u2.pth and .pyconfig configuration files, these are referenced in the U2 product documentation set in the Python User Guide. This can be downloaded from https://rbc.rocketsoftware.com/ using Resources -> Product Availability -> (choose) UniVerse (version)  / (platform) -> (select) and look under the Documentation download link.

    I will also mention for completeness the UOPY though I suspect that this may not be what you were looking for:

    Hoping this helps, if we can help further please post additional explanation of the planned integration and usage.

    Regards

    JJ



    ------------------------------
    John Jenkins
    Thame, Oxfordshire
    ------------------------------



  • 3.  RE: Integration Django with u2 python

    Posted 02-07-2024 11:04
    Edited by Gnanaseelan gnanapirakasam 02-08-2024 08:30

    Hi @John Jenkins

    Thank you so much for your prompt reply and guidance.

    Regarding UOPY, do you have any suggestions on how to avoid the session creation in each API call?

    example:

    import uopy
    
    @api_view(['POST'])
    def logIn(request):
        session = ''
        if session == '':
        session = uopy.connect(user = 'test',password = 'test@123')
        user_name  = request.data.get("username")
        pass_word  = request.data.get("password")
    
        sub = uopy.Subroutine("GREET.USER",3)
        sub.args[0] = user_name
        sub.args[1] = pass_word
        sub.call()
    
        messages = ''
        logger.error(sub.args[2])
        json_response = ''
    
        if sub.args[2] == 200 :
            messages = "Successfully login"
            json_response = {"status" : "200","message" : messages}
        else :
            messages = "incorrect username or password"
            json_response = {"status" : "401","message" : messages}
    
        session.close()
        logger.error(session)
    
        return Response(json_response)



    ------------------------------
    Gnanaseelan gnanapirakasam
    SSE
    Rocket Forum Shared Account
    ------------------------------



  • 4.  RE: Integration Django with u2 python

    Posted 02-09-2024 07:54

    Gnanaseelan,

    I recommend taking a look at Connection Pooling. While the overheads of starting a fresh session/connection can be tweked by general system tuning, it cannot be adjusted or removed in itself. Youy can however re-use a connection once established using Connection Pooling functionality, noting that you would need to add Connection Pooling (CP) as a license feature by acquiring CP licenses from Rocket.

    Regards,

    John Jenkins.



    ------------------------------
    John Jenkins
    Thame, Oxfordshire
    ------------------------------



  • 5.  RE: Integration Django with u2 python

    Posted 02-13-2024 03:44

    Hi @John Jenkins,

    I appreciate your feedback; it has been instrumental in clarifying the details surrounding UOPY connection pooling and RU license requirements.

    I wanted to follow up with a specific question: Are there any RU license costs associated with invoking Python code in the XDEMO account? Your insights on this matter would be greatly beneficial for our planning.

    Thank you for your time and assistance.

    Best regards,

    Seelan



    ------------------------------
    Gnanaseelan gnanapirakasam
    SSE
    Rocket Forum Shared Account
    ------------------------------



  • 6.  RE: Integration Django with u2 python

    Posted 02-14-2024 04:57

    Gnanaseelan,

    Connection Pooling licenses in the database are system-wide and not specific to an account. When you use a Connection Pooled (CP)c onnection you connect just the same as you would do without CP, but the way license slots are utilised is different.

    An Enterprise license has two CP licenses included, other license types have none. Additional licenses can be purchased from your usual supplier or Rocket directly as appropriate for all license types. How many would you neeed? - not an easy question - I recommend a minimum of two. Beyond that depends upon calculations based opon the time taken to turn around a request - peak and average - and the peak number of requests. See the Erlang calculation online for some background on calculation. Alternatively you could request a number of evaluation licenses and play with reducing the numbers under heavy/peak load  until the response time becomes too long and then back off a little. You then have a number of licenses you can use as a guide for purchasing.

    Please contact your normal sales route for pricing. 

    Regards

    JJ



    ------------------------------
    John Jenkins
    Thame, Oxfordshire
    ------------------------------



  • 7.  RE: Integration Django with u2 python

    ROCKETEER
    Posted 02-14-2024 08:54

    Seelan,

    I assume when you ask about the cost of a RU (re-use of a license) you are asking about performance impact.  There is an initial start up cost of starting a uopy connection, additionally there is the the cost to initialize your code (i.e. opening files, and setting up environment).

    With the connection pool, the cost of starting the session is only occurred once, and if you employ named common in your subroutines, you can minimize the cost of opening files.

    Is that what you were looking for?  



    ------------------------------
    Mike Rajkowski
    MultiValue Product Evangelist
    Rocket Internal - All Brands
    US
    ------------------------------