Scenario run Last Business date of the month
![Pauline](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar10.png)
Dear community,
I have just started using Dataiku and creating a couple of data models.
I have used the automation scenario with simple by default settings offered by Dataiku. But now I would like to automate the run for one of my data models to run on a monthly basis for the Last Business date of the month.
Anyone on how I could achieve this?
Thank you!
Best Answer
-
Hi Pauline,
Assuming you are using DSS version 9, you can use "Time-based" trigger and set "Repeat every" to 1 month and see if any condition will meet your requirements in the "Run on" dropdown. Please note: depending on the day selected, you may have some additional "Run on" dropdown option. Like in my example below, I chose the last Friday of the month, and that option appeared in the dropdown.
Regarding your question to set up a trigger to run on the last business day of the month, there is no option available at the moment. However, you can utilise custom trigger and python code for such custom requirements. Please check an example I have created below:
Screenshot:Code:
import pandas as pd from datetime import datetime #get today's date in YYYY-MM-DD format todaystr = datetime.today().strftime("%Y-%m-%d") s = pd.date_range(todaystr, periods=1, freq='BM') df = pd.DataFrame(s, columns=['Date']) #get last working day of the current month from created dataframe above lastBDCMstr = df.iloc[0]['Date'].strftime("%Y-%m-%d") if lastBDCMstr == todaystr: from dataiku.scenario import Trigger t = Trigger() t.fire()
Above I utilised pandas, but for sure, there are many other ways to do it.I hope this helps.
Best,
Vitaliy
Answers
-
Pauline Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 2 ✭✭✭
Hi Vitaliy,
The option in Dataiku version 9 looks pretty cool, unfortunately I have the 8th version.
But the custom trigger with the python code is super! I didn't realize this functionality. Thank you very much!
Best,
Pauline