Closed vioreldinu87 closed 4 years ago
You may want to call
response = cubes.status(connection, cube_id, verbose=False)
https://github.com/MicroStrategy/mstrio-py/blob/master/mstrio/api/cubes.py#L163
Then get the cube status like
cube_publication_status = response.headers['X-MSTR-CubeStatus']
cube_publication_status
is an enumeration defined here: https://lw.microstrategy.com/msdz/msdl/GARelease_Current/docs/ReferenceFiles/reference/com/microstrategy/webapi/EnumDSSCubeStates.html
If you want to wait until it has been published spin while this condition is true:
cube_publication_status & 64 != 64
@vioreldinu87 the default behavior is to auto-publish the cube after uploading data to it. You should only need to check status if publishing manually. Read more here and let us know your thoughts?
Hi I'm using this to check the cube status during publication:
import requests, json
from pandas.io.json import json_normalize
import time
def publish_cube(cube_id, conn):
# publish the cube
req_url=url+'/cubes/'+cube_id
#verbose
#print(token, headers, cookies, cube_id,req_url)
#post the request
resp = requests.post(req_url, headers=headers,cookies=conn.cookies, verify=root_certificate)
# Check the cube status
req_url=url+'/cubes?id='+cube_id
resp = requests.get(req_url, headers=headers,cookies=conn.cookies, verify=root_certificate)
json_data = json.loads(resp.text)
cubes_infos=json_normalize(json_data, 'cubesInfos')
while cubes_infos.status[0] !=17510 :
print('cube {} is being published with status {}'.format(cube_id,cubes_infos.status[0] ))
time.sleep(15)
resp = requests.get(req_url, headers=headers,cookies=conn.cookies, verify=root_certificate)
json_data = json.loads(resp.text)
cubes_infos=json_normalize(json_data, 'cubesInfos')
print('cube {} is published with status {}'.format(cube_id,cubes_infos.status[0] ))
return cubes_infos.T
Hi,
I'm trying to publish an intelligent cube from python using mstrio. After the publication begins, i don't know the cube status.