Skip to content

Commit 4e0ed83

Browse files
committed
Raise exception when running other than a sync recipe with output STREAMING_ENDPOINT
1 parent 1bbab01 commit 4e0ed83

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dataikuapi/dss/recipe.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def run(self, job_type="NON_RECURSIVE_FORCED_BUILD", partitions=None, wait=True,
7777
:rtype: :class:`dataikuapi.dss.job.DSSJob`
7878
"""
7979
project = self.client.get_project(self.project_key)
80+
settings = self.get_settings()
8081
outputs = project.get_flow().get_graph().get_successor_computables(self)
8182

8283
if len(outputs) == 0:
@@ -90,11 +91,16 @@ def run(self, job_type="NON_RECURSIVE_FORCED_BUILD", partitions=None, wait=True,
9091
"COMPUTABLE_SAVED_MODEL": "SAVED_MODEL",
9192
"COMPUTABLE_STREAMING_ENDPOINT": "STREAMING_ENDPOINT",
9293
}
94+
95+
if first_output["type"] == "COMPUTABLE_STREAMING_ENDPOINT" and not isinstance(settings, SyncRecipeSettings):
96+
raise Exception(
97+
"Cannot run recipe with output type STREAMING_ENDPOINT. Use a dataikuapi.dss.continuousactivity.DSSContinuousActivity instead")
98+
9399
if first_output["type"] in object_type_map:
94100
jd = project.new_job(job_type)
95101
jd.with_output(first_output["ref"], object_type=object_type_map[first_output["type"]], partition=partitions)
96102
else:
97-
raise Exception("recipe has unsuported output type {}, can't run it".format(first_output["type"]))
103+
raise Exception("Recipe has unsupported output type {}, can't run it".format(first_output["type"]))
98104

99105
if wait:
100106
return jd.start_and_wait()

0 commit comments

Comments
 (0)