Skip to content

Commit 5787dea

Browse files
committed
add redeploy command
1 parent 96d8672 commit 5787dea

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

dataikuapi/dss/ml.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,25 @@ def deploy_to_flow(self, model_id, model_name, train_dataset, test_dataset=None,
570570
"POST", "/projects/%s/models/lab/%s/%s/models/%s/actions/deployToFlow" % (self.project_key, self.analysis_id, self.mltask_id, model_id),
571571
body = obj)
572572

573+
574+
def redeploy_to_flow(self, model_id, recipe_name=None, saved_model_id=None, activate=True):
575+
"""
576+
Redeploys a trained model from this ML Task to a saved model + train recipe in the Flow. Either
577+
recipe_name of saved_model_id need to be specified
578+
579+
:param str model_id: Model identifier, as returned by :meth:`get_trained_models_ids`
580+
:param str recipe_name: Name of the training recipe to update
581+
:param str saved_model_id: Name of the saved model to update
582+
:param bool activate: Should the deployed model version become the active version
583+
:return: A dict containing: "impactsDownstream" - whether the active version changed and downstream recipes are impacted
584+
:rtype: dict
585+
"""
586+
obj = {
587+
"recipeName" : recipe_name,
588+
"savedModelId" : saved_model_id,
589+
"activate" : activate
590+
}
591+
return self.client._perform_json(
592+
"POST", "/projects/%s/models/lab/%s/%s/models/%s/actions/redeployToFlow" % (self.project_key, self.analysis_id, self.mltask_id, model_id),
593+
body = obj)
594+

0 commit comments

Comments
 (0)