progress of recipes while running in webapp backend
hello,
I would like to know if there is a way with python script to display the progress of the flow in the webapp for a user in order to see if the job is complete
thanks
Kenza
Answers
-
Hi Kenza29,
The Jobs API allow you to list jobs for a given project and find out which one(s) are active. In particular, the dataikuapi.dss.job.DssJob.get_status() method gives you the state of all the job's activities, as illustrated in this minimal example:
import dataiku client = dataiku.api_client() project = client.get_project("MY_PROJECT_KEY") job_status = project.get_job("MY_JOB_ID").get_status() state = job_status["baseStatus"]["activities"]["MY_ACTIVITY_ID"]["state"]
Retrieving that information in the backend of your webapp should allow you to track the progress of your job.
Best,
Harizo
-
hello,
Thanks for you r answer, my skills on web development are very limited so I don't know how to pass the status to the front end and display in the webapp when job is done.
I can see it in the logs of the webapp but I need to display the information at the user interface.
Thanks again
Kenza
-
Hi Kenza,
If you want to better understand how webapps work in DSS, you can go through this tutorial. Even though it assumes basic knowledge of web development, its content is detailed enough to provide a good grasp of the important details. In particular, there is a section explaining how data can be sent from the backend to the frontend using routes in the backend's Python code.
Best,
Harizo