how to obtain the enterprise licensed limits and amounts used with python api

jrmathieu63
jrmathieu63 Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 26 ✭✭✭✭✭
edited July 16 in Using Dataiku

Trying to use get_licensing_status with DSSClient but the dictionary just reports NaN as values for base and limits for the userProfiles, licensedProfiles and profileLimits.

Example

license_info = pd.DataFrame(client.get_licensing_status())


Operating system used: AL2

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,024 Neuron

    client.get_licensing_status() returns a Python dictionary so you have to do some coding to convert it to a data frame since it's not a tabular data structure. But it shouldn't be too hard to do it, it depends on what you want to get.

    Screenshot 2024-01-22 at 21.42.51.png

  • jrmathieu63
    jrmathieu63 Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 26 ✭✭✭✭✭
    edited July 17

    While this info was help, it did still require more details to determine how to approach to extract the information required.

    If inexperience as I am and not afraid to state that, I am provided the solution(s) I can up with to hopefully someone can provide some feedback on best approach or an improvement on this.

    First and more straight forward.

    license_info = client.get_licensing_status()
    READER_MAX = license_info['limits']['profileLimits']['READER']['licensed']['licensedLimit']
    READER_CNT= license_info['limits']['profileLimits']['READER']['directCount']
    print('Reader Max', READER_MAX, 'Reader Count', READER_CNT)


    Second using a function.

    def get_value(dict, *keys):
        # loop over the keys
        for key in keys:
            # get the value of the current key
            dict = dict.get(key)
            # if the value is None, return None
            if dict is None:
                return None
        # return the final value
        return dict
    
    READER_MAX = get_value(license_info, 'limits', 'profileLimits', 'READER', 'licensed', 'licensedLimit')
    READER_CNT = get_value(license_info, 'limits', 'profileLimits', 'READER', 'directCount')
    # print the values
    print('Reader Max', READER_MAX, 'Reader Count', READER_CNT)

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,024 Neuron

    Thanks for posting back for others to benefit. The problems where one needs to work to get to the solution are the most rewarding in my view, as you get to learn in the process. The other thing to consider is that the scope of your original question was too wide open. There was no clarity of what you wanted to do with the output. The data was in a Python dictionary, so if this didn't suit your needs then you could have asked on how to extract the values which is what you ended up doing.

Setup Info
    Tags
      Help me…