cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a working Python script into Bash to upload as Pre/Post Build Script

HemaK
7 - Data Storage
7 - Data Storage

I have a customized automation script for row level security written in Python using the Pysense library. We were planning to use this to upload as a Pre/Post build script on the elasticube end over the admin page to automate the script execution with the cube build. But according to the documentations, it says that it only allows a bash script. I do not have knowledge/ skill on bash scripts. Is there any easy way for me to convert this working python script with pysense library into a bash script?

Any kind of help would be appreciated. 

Thanks
Hema

3 REPLIES 3

HamzaJ
10 - ETL
10 - ETL

Hi @HemaK 

It is possible to include regular CLI in the bash. We have a similar workflow and in a prebuild.sh-file we have added the following line:

sudo python3 /opt/sisense/storage/external-plugins/python/app.py

This will execute the python script before the build of the ecube. 

Hamza

HemaK
7 - Data Storage
7 - Data Storage

Hey @HamzaJ 

Thank you for your response. I have the bash script and the python script that are working now on my local machine. But i couldn't make them work when i upload them on the sisense server. The log files and the build shows that the post build plugin was successfully executed, but the result I need doesn't show up on the dashboards. 

The python script has a dependable csv file that needs to be uploaded. Where should i upload these python file and it's dependable files for the bash to take up? Currently, I have uploaded everything under the Farm folder where i uploaded the postbuild.sh script. Let me know if that is not the case. 

Thanks in advance 
Hema

Hi @HemaK ,

If its a post-build script how does the dashboard use the result of that? What does it do? The python script will be run after the build is finished. If it's data related there is a chance that its not reflected in the dashboard. A pre-build script would be better in that case.

Sisense has a post-build script which exports CSVs after a build. There you can find an example of setting the directory and parse this as a parameter to the bash. https://documentation.sisense.com/docs/pre-post-build-plugins

Otherwise you could also hardcode the path and file in the bash: 

sudo python3 /opt/sisense/storage/external-plugins/python-folder/app.py