force rebuild setting in scenario script
Hi Dataiku support team,
I am writing python script to run the scenario.
from dataiku.scenario import Scenario from datetime import datetime, timedelta # The Scenario object is the main handle from which you initiate steps scenario = Scenario() # get date current_date = datetime.today() chosen_date = current_date - timedelta(1) formated_chosen_date = chosen_date.strftime('%Y-%m-%d') scenario.build_dataset("sample_dataset")
In the code above, i want to set force_rebuild the "sample_dataset" when running scenario. Is there any parameter setting in the function build_dataset to do this.
Thanks
Best Answer
-
OH, i figure out the setting parameters "build_mode" from scenario.build_dataset() api
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,166 Neuron
The Scenario object is a special object to obtain a handle to a running scenario inside the scenario itself via a scenario step, so unless that's what you are doing (which it doesn't look like) then that's not the correct way to run a scenario.
Here are two variants on how to run a Scenario:
https://developer.dataiku.com/latest/concepts-and-examples/scenarios.html#run-a-scenario
And here it shows how to get a handle to the Dataiku API Client and to the project where you have the scenario you want to run:
-
yeap, so even in the link show it still not answer my concern. How to set force_rebuild in the script?
-
I mean, when creating scenario either we set steps through GUI like the attached figure. There's a text box to choose to "force rebuild dataset".
Equivalently, there's script option when creating scenario which give me more flexible to creating scenarios. So my question is how to set force rebuild in the script.
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,166 Neuron
The way you asked your question is confusing. Setting the force rebuild in a step has nothing to do with running a scenario. Also there is a difference between creating a scenario from scratch and changing an already existing scenario step. Please note that the force rebuil is a step setting and is persistent, which means that if you change via code it will remain like that for ever. Depending on what you are trying to do this may or may not the way you want things to be.