MicroStrategy / mstrio-py

Python integration for MicroStrategy
Apache License 2.0
90 stars 60 forks source link

How to check if the Cube is successfully re-published? #69

Closed SamiRehmanNostra closed 3 years ago

SamiRehmanNostra commented 3 years ago

How can I check if a cube has been successfully refreshed, the status I receive if 17510 which means the processing of the cube is finished, but it doesn't tell me if the cube has refreshed or crashed?

while "Processing" in status:
    time.sleep(15)
    olap_cube_.refresh_status()
    print("refreshing status...")
    res = cubes.cube_info(connection=connection, id=cubeID)
    json_data = json.loads(res.text)
    cubes_infos=json_normalize(json_data, 'cubesInfos')
    print('cube {} is being published with status {}'.format(cube_id,cubes_infos.status[0] ))
    status=olap_cube_.show_status()
    if "Processing" not in status:
        print(olap_cube_._get_info())
        print("cube refreshed!")
        break

Please note I want to ensure that the cube has successfully been re-published.

urszulajaczewska commented 3 years ago

Hi @SamiRehmanNostra,

you can check cube state using following code:

from mstrio.project_objects.datasets.cube import CubeStates
CubeStates.show_status(17510)

The output in this case is: ['Imported', 'Ready', 'Loaded', 'Persisted', 'Active', 'Reserved']

All of the possible states are listed under CubeState class. If there would be any problem with cube, you will receive in the output Dirty or Dirty Info state.